Advertisement
bonniekawaiidesu

Untitled

Mar 3rd, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.72 KB | None | 0 0
  1. function sandbox(var,func)
  2. local env = getfenv(func)
  3. local newenv = setmetatable({},{
  4. __index = function(self,k)
  5. if k=="script" then
  6. return var
  7. else
  8. return env[k]
  9. end
  10. end,
  11. })
  12. setfenv(func,newenv)
  13. return func
  14. end
  15. cors = {}
  16. mas = Instance.new("Model",game:GetService("Lighting"))
  17. Tool0 = Instance.new("Tool")
  18. LocalScript1 = Instance.new("LocalScript")
  19. MeshPart2 = Instance.new("MeshPart")
  20. LocalScript3 = Instance.new("LocalScript")
  21. ModuleScript4 = Instance.new("ModuleScript")
  22. Configuration5 = Instance.new("Configuration")
  23. NumberValue6 = Instance.new("NumberValue")
  24. NumberValue7 = Instance.new("NumberValue")
  25. BoolValue8 = Instance.new("BoolValue")
  26. NumberValue9 = Instance.new("NumberValue")
  27. NumberValue10 = Instance.new("NumberValue")
  28. Sound11 = Instance.new("Sound")
  29. LocalScript12 = Instance.new("LocalScript")
  30. Camera13 = Instance.new("Camera")
  31. Tool0.Name = "Portal Gun"
  32. Tool0.Parent = mas
  33. Tool0.Grip = CFrame.new(-0.63109529, 0.452967376, -0.402335078, 0.994709015, 0.000125572755, 0.102732286, 0.102732286, 1.29689943e-05, -0.994709015, -0.000126240688, 1, 0)
  34. Tool0.GripForward = Vector3.new(-0.102732286, 0.994709015, -0)
  35. Tool0.GripPos = Vector3.new(-0.63109529, 0.452967376, -0.402335078)
  36. Tool0.GripRight = Vector3.new(0.994709015, 0.102732286, -0.000126240688)
  37. Tool0.GripUp = Vector3.new(0.000125572755, 1.29689943e-05, 1)
  38. LocalScript1.Name = "AnimateScript(EM-500)"
  39. LocalScript1.Parent = Tool0
  40. table.insert(cors,sandbox(LocalScript1,function()
  41. local MOUSE_ICON = 'rbxassetid://120192974' local Tool = script.Parent
  42. local Mouse = nil local function UpdateIcon()
  43. if Mouse then Mouse.Icon = Tool.Enabled and MOUSE_ICON end end local function OnEquipped(mouse) Mouse = mouse UpdateIcon() end local function OnChanged(property)
  44. if property == 'Enabled' then UpdateIcon() end end Tool.Equipped:connect(OnEquipped) Tool.Changed:connect(OnChanged)
  45.  
  46. local arms = nil
  47. local torso = nil
  48. local welds = {}
  49. local Tool = script.Parent
  50. local neck = nil
  51. local orginalC0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  52.  
  53. function Equip(mouse)
  54. wait(0.01)
  55. arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
  56. head = Tool.Parent:FindFirstChild("Head")
  57. torso = Tool.Parent:FindFirstChild("Torso")
  58. if neck == nil then
  59. neck = Tool.Parent:FindFirstChild("Torso").Neck
  60. end
  61. if arms ~= nil and torso ~= nil then
  62. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  63. if sh ~= nil then
  64. local yes = true
  65. if yes then
  66. yes = false
  67. sh[1].Part1 = nil
  68. sh[2].Part1 = nil
  69. local weld1 = Instance.new("Weld")
  70. weld1.Part0 = head
  71. weld1.Parent = head
  72. weld1.Part1 = arms[1]
  73. welds[1] = weld1
  74. local weld2 = Instance.new("Weld")
  75. weld2.Part0 = head
  76. weld2.Parent = head
  77. weld2.Part1 = arms[2]
  78. welds[2] = weld2
  79. -------------------------here
  80. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
  81. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  82. mouse.Move:connect(function ()
  83. --local Direction = Tool.Direction.Value
  84. local Direction = mouse.Hit.p
  85. local b = head.Position.Y-Direction.Y
  86. local dist = (head.Position-Direction).magnitude
  87. local answer = math.asin(b/dist)
  88. neck.C0=orginalC0*CFrame.fromEulerAnglesXYZ(answer,0,0)
  89. wait(0.1)
  90. end)end
  91. else
  92. print("sh")
  93. end
  94. else
  95. print("arms")
  96. end
  97. end
  98.  
  99. function Unequip(mouse)
  100. if arms ~= nil and torso ~= nil then
  101. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  102. if sh ~= nil then
  103. local yes = true
  104. if yes then
  105. yes = false
  106. neck.C0 = orginalC0
  107.  
  108. sh[1].Part1 = arms[1]
  109. sh[2].Part1 = arms[2]
  110. welds[1].Parent = nil
  111. welds[2].Parent = nil
  112. end
  113. else
  114. print("sh")
  115. end
  116. else
  117. print("arms")
  118. end
  119. end
  120. Tool.Equipped:connect(Equip)
  121. Tool.Unequipped:connect(Unequip)
  122.  
  123. function Animate()
  124. arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
  125. if Tool.AnimateValue.Value == "Shoot" then
  126. local weld1 = welds[1]
  127. local weld2 = welds[2]
  128. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
  129. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  130. wait(0.00001)
  131. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.05, math.rad(-90))
  132. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  133. wait(0.00001)
  134. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.1, math.rad(-90))
  135. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-95), math.rad(-15), 0)
  136. wait(0.00001)
  137. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.3, math.rad(-90))
  138. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-110), math.rad(-15), 0)
  139. wait(0.00001)
  140. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.35, math.rad(-90))
  141. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-115), math.rad(-15), 0)
  142. wait(0.00001)
  143. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
  144. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
  145. wait(0.00001)
  146. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
  147. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  148. Tool.AnimateValue.Value = "None"
  149. end
  150. if Tool.AnimateValue.Value == "Reload" then
  151. local weld1 = welds[1]
  152. local weld2 = welds[2]
  153. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
  154. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  155. wait(0.0001)
  156. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
  157. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  158. wait(0.0001)
  159. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
  160. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-95), math.rad(-15), 0)
  161. wait(0.0001)
  162. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
  163. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-100), math.rad(-15), 0)
  164. wait(0.0001)
  165. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
  166. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-105), math.rad(-15), 0)
  167. wait(0.0001)
  168. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
  169. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-110), math.rad(-15), 0)
  170. wait(0.0001)
  171. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
  172. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-115), math.rad(-15), 0)
  173. wait(0.0001)
  174. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.45, math.rad(-90))
  175. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
  176. wait(0.0001)
  177. weld1.C1 = CFrame.new(-0.5+1.5, 0.9, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.5, math.rad(-90))
  178. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
  179. wait(0.0001)
  180. weld1.C1 = CFrame.new(-0.5+1.5, 1, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.55, math.rad(-90))
  181. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
  182. wait(0.0001)
  183. weld1.C1 = CFrame.new(-0.5+1.5, 1.1, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.57, math.rad(-90))
  184. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
  185. wait(0.0001)
  186. weld1.C1 = CFrame.new(-0.5+1.5, 1.2, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.6, math.rad(-90))
  187. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
  188. wait(0.0001)
  189. weld1.C1 = CFrame.new(-0.5+1.5, 1.3, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.6, math.rad(-90))
  190. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
  191. wait(0.0001)
  192. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
  193. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  194. Tool.AnimateValue.Value = "None"
  195. end
  196. end
  197.  
  198. Tool.AnimateValue.Changed:connect(Animate)
  199.  
  200. end))
  201. MeshPart2.Name = "Handle"
  202. MeshPart2.Parent = Tool0
  203. MeshPart2.CFrame = CFrame.new(-4.80153465, 1.16627014, -8.13521767, 9.90927219e-07, 1.00000727, -1.79058759e-06, -1.51428281e-07, -1.98858993e-06, 1.00000024, 0.999996245, 8.86619091e-07, -2.49169943e-07)
  204. MeshPart2.Orientation = Vector3.new(-90, -90, 0)
  205. MeshPart2.Position = Vector3.new(-4.80153465, 1.16627014, -8.13521767)
  206. MeshPart2.Rotation = Vector3.new(-90, 0, -90)
  207. MeshPart2.Size = Vector3.new(2.19040489, 4.31696177, 2.25249791)
  208. MeshPart2.CanCollide = false
  209. MeshPart2.TextureID = "rbxassetid://430056584"
  210. LocalScript3.Parent = Tool0
  211. table.insert(cors,sandbox(LocalScript3,function()
  212. local tool = script.Parent
  213. local debris = game:GetService("Debris")
  214. local timestart = false
  215. local timer = 0
  216. local model = Instance.new("Model",game.Workspace)
  217. local colora = BrickColor.new(Color3.new(math.random(255)/255,math.random(255)/255,math.random(255)/255))
  218. local colorb = BrickColor.new(Color3.new(math.random(255)/255,math.random(255)/255,math.random(255)/255))
  219. print(colora)
  220. print(colorb)
  221. tool:WaitForChild("Settings")
  222. local pp = script.Parent.Settings.PortalPower
  223. local cw = script.Parent.Settings.CameraWait
  224. local cg --[[;^)]] = script.Parent.Settings.CanGrab
  225. local gp = script.Parent.Settings.GrabPower
  226. local gr = script.Parent.Settings.GrabRange
  227. script.Parent:WaitForChild("surface")
  228. funcs = require(script.Parent.surface)
  229.  
  230. function gpos(part,pos,ignore)
  231. local r = Ray.new(part.Position,(pos-part.Position).unit*999)
  232. return workspace:FindPartOnRayWithIgnoreList(r,ignore)
  233. end
  234.  
  235. tool.Equipped:connect(function (mouse)
  236. script.Parent.Handle.Anchored = false
  237. local player = game.Players.LocalPlayer
  238. local grabbed_object = nil
  239. model.Name = player.Name.."'s Portals"
  240. local canTeleport = true
  241.  
  242. function getModelMass(model)
  243. if model == nil then return 0 end
  244. local mass = 0
  245. local function getModelMass(m)
  246. for i,v in pairs(m:GetChildren()) do
  247. if v:IsA("BasePart") then
  248. mass = mass + v:GetMass()
  249. elseif v:IsA("Model") then
  250. getModelMass(v)
  251. end
  252. end
  253. end
  254. getModelMass(model)
  255. return mass
  256. end
  257.  
  258. function telePortal(hit, blue)
  259. if hit == grabbed_object then
  260. grabbed_object.Grab:Destroy()
  261. grabbed_object = nil
  262. end
  263. if model:findFirstChild("BluePortal") and model:findFirstChild("RedPortal") then
  264. if hit.Parent and hit.Parent ~= workspace and hit.Anchored == false then
  265. if getModelMass(hit.Parent) > 60 then return else
  266. if hit.Parent:findFirstChild("Torso") then
  267. hit = hit.Parent.Torso
  268. end
  269. end
  270. else
  271. if hit:getMass() > 60 or hit.Anchored then return end
  272. end
  273.  
  274. local this
  275. local other
  276.  
  277. if blue then
  278. this = model.BluePortal
  279. other = model.RedPortal
  280. else
  281. this = model.RedPortal
  282. other = model.BluePortal
  283. end
  284.  
  285. local x = math.abs(hit.Velocity.x)
  286. local y = math.abs(hit.Velocity.y)
  287. local z = math.abs(hit.Velocity.z)
  288.  
  289. local main = 0
  290. if x > y and x > z then
  291. main = x
  292. elseif y > x and y > z then
  293. main = y
  294. elseif z > x and z > y then
  295. main = z
  296. end
  297. main = math.ceil(main)
  298. local dir = other.CFrame.lookVector
  299. local spawn = other.CFrame.p + (dir*3)
  300. hit.CFrame = CFrame.new(spawn, spawn+dir*2)
  301. hit.Velocity = dir*main*pp.Value
  302. end
  303. end
  304.  
  305. function makePortal(pos, hit, blue)
  306. local p = Instance.new("Part", model)
  307. if blue then p.Name = "BluePortal" else p.Name = "RedPortal" end
  308. if blue then p.BrickColor = colora else p.BrickColor = colorb end
  309. p.Material = Enum.Material.Neon
  310. p.FormFactor = Enum.FormFactor.Custom
  311. p.Size = Vector3.new(4,6,3)
  312. p.TopSurface = 0
  313. p.BottomSurface = 0
  314. p.Anchored = true
  315. local p2 = Instance.new("Part", model)
  316. p2.Size = Vector3.new(0.2,0.2,0.2)
  317. p2.CanCollide = false
  318. p2.TopSurface = 0
  319. p2.BottomSurface = 0
  320. p2.BrickColor = p.BrickColor
  321. if blue then
  322. p2.Name = "BP"
  323. else
  324. p2.Name = "RP"
  325. end
  326. local sm2 = Instance.new("SpecialMesh", p2)
  327. sm2.Scale = Vector3.new(0.45, 0.3, 0.0018)
  328. sm2.MeshId = "rbxassetid://431119824"
  329. local sm = Instance.new("SpecialMesh",p)
  330. sm.MeshType = "Sphere"
  331. sm.Scale = Vector3.new(1,1,0.01)
  332. p.CanCollide = false
  333. local dir = funcs.getSide(hit,funcs.surface(hit,pos))
  334. p.CFrame = CFrame.new(pos, pos + dir)
  335. p2.CFrame = p.CFrame * CFrame.Angles(0,0,math.pi/2)
  336. funcs.weld(p2,p)
  337. if hit.Anchored == false then
  338. local pos = p.CFrame:inverse() * hit.CFrame
  339. funcs.weld(p,hit)
  340. p.Anchored = false
  341. p.ChildRemoved:connect(function (c)
  342. if c.Name == "Weld" then
  343. p:Destroy()
  344. p2:Destroy()
  345. end
  346. end)
  347. end
  348. p.Touched:connect(funcs.debounce(function (h) if canTeleport then canTeleport = false telePortal(h,blue) wait(.1) canTeleport = true end end))
  349. end
  350.  
  351. function firePortal(origin,dir,blue,chit,target)
  352. local p = Instance.new("Part", game.Workspace)
  353. p.FormFactor = Enum.FormFactor.Custom
  354. p.Size = Vector3.new(.1,.1,.1)
  355. p.TopSurface = 0
  356. p.BottomSurface = 0
  357. if blue then
  358. p.BrickColor = colora
  359. else
  360. p.BrickColor = colorb
  361. end
  362. p.Material = Enum.Material.Neon
  363. local sm = Instance.new("SpecialMesh",p)
  364. sm.MeshType = "Sphere"
  365. sm.Scale = Vector3.new(10,10,10)
  366. p.Reflectance = 1
  367. local bf = Instance.new("BodyForce",p)
  368. bf.force = Vector3.new(0,196.2,0)*p:GetMass()
  369. p.Velocity = dir*200
  370. p.CFrame = CFrame.new(origin,origin+dir)
  371. p:BreakJoints()
  372. tool.Fire:Play()
  373. funcs.debounce(p.Touched:connect(function (h)
  374. if blue and target then
  375. if model:FindFirstChild("BluePortal") then model.BluePortal:Destroy() end
  376. if model:FindFirstChild("BP") then model.BP:Destroy() end
  377. makePortal(chit,target,true)
  378.  
  379. elseif not blue and target then
  380. if model:FindFirstChild("RedPortal") then model.RedPortal:Destroy() end
  381. if model:FindFirstChild("RP") then model.RP:Destroy() end
  382. makePortal(chit,target,false)
  383. end
  384. p:Destroy()
  385. end))
  386. debris:AddItem(p,120)
  387. end
  388.  
  389. funcs.debounce(mouse.Button2Down:connect(function ()
  390. timestart = false
  391. wait(cw.Value)
  392. timestart = true
  393. end))
  394.  
  395. funcs.debounce(mouse.Button1Down:connect(function ()
  396. local dir = (mouse.Hit.p - player.Character.Head.Position).unit
  397. local origin = player.Character.Head.Position + dir*5
  398. local block, pos = gpos(tool.Handle,mouse.Hit.p,{tool.Parent,model,grabbed_object})
  399. firePortal(origin,dir,true,pos,block)
  400. end))
  401.  
  402. funcs.debounce(mouse.Button2Up:connect(function ()
  403. if timestart then return end
  404. local dir = (mouse.Hit.p - player.Character.Head.Position).unit
  405. local origin = player.Character.Head.Position + dir*5
  406. local block, pos = gpos(tool.Handle,mouse.Hit.p,{tool.Parent,model,grabbed_object})
  407. firePortal(origin,dir,false,pos,block)
  408. end))
  409.  
  410. funcs.debounce(mouse.KeyDown:connect(function (k)
  411. local mt = mouse.Target
  412. if mt then
  413. if k == "e" and cg.Value then
  414. if grabbed_object == nil and (mt.Position - tool.Handle.Position).magnitude < gr.Value then
  415. if mt:getMass() > gp.Value then return end
  416. mt.CFrame = tool.Handle.CFrame * CFrame.new(0,6,0)
  417. local w = funcs.weld(mt, tool.Handle)
  418. w.Name = "Grab"
  419. grabbed_object = mt
  420. elseif grabbed_object then
  421. grabbed_object.Grab:Destroy()
  422. grabbed_object.Velocity = tool.Parent.Torso.CFrame.lookVector*100
  423. grabbed_object = nil
  424. end
  425. end
  426. end
  427.  
  428. if k == "r" then
  429. model:ClearAllChildren()
  430. end
  431. end))
  432.  
  433. local event = workspace.ChildRemoved:connect(function (c)
  434. if c == model then
  435. model = Instance.new("Model", workspace)
  436. model.Name = player.Name.."'s Portals"
  437. end
  438. end)
  439.  
  440. player.Character.Humanoid.Died:connect(function ()
  441. event:disconnect()
  442. model:Destroy()
  443. end)
  444. end)
  445.  
  446. tool.Unequipped:connect(function ()
  447. if tool.Parent == game.Workspace then
  448. model:Destroy()
  449. model = Instance.new("Model", workspace)
  450. end
  451. end)
  452. end))
  453. ModuleScript4.Name = "surface"
  454. ModuleScript4.Parent = Tool0
  455. table.insert(cors,sandbox(ModuleScript4,function()
  456. local module = {}
  457.  
  458. --vvv Made by Anaminus vvv---
  459. local function NumNormal(n)
  460. return n == 0 and 0 or n/math.abs(n)
  461. end
  462.  
  463. function module.surface(part,point)
  464. local p = part.CFrame:toObjectSpace(CFrame.new(point)).p
  465. local s = part.Size
  466. local ax,ay,az = math.abs(p.x/s.x),math.abs(p.y/s.y),math.abs(p.z/s.z)
  467. return Vector3.new(NumNormal(p.x),NumNormal(p.y),NumNormal(p.z)) * Vector3.new(
  468. (ax>ay and ax>az) and 1 or 0,
  469. (ay>ax and ay>az) and 1 or 0,
  470. (az>ax and az>ay) and 1 or 0
  471. )
  472. end
  473. --^^^ Made by Anaminus ^^^---
  474.  
  475. function module.getSide(p,s)
  476. local cf = p.CFrame
  477. if s.x > 0 then
  478. return (cf*CFrame.fromAxisAngle(Vector3.new(0,-1,0),math.pi/2)).lookVector
  479. elseif s.x < 0 then
  480. return (cf*CFrame.fromAxisAngle(Vector3.new(0,1,0),math.pi/2)).lookVector
  481. end
  482.  
  483. if s.y < 0 then
  484. return (cf*CFrame.fromAxisAngle(Vector3.new(-1,0,0),math.pi/2)).lookVector
  485. elseif s.y > 0 then
  486. return (cf*CFrame.fromAxisAngle(Vector3.new(1,0,0),math.pi/2)).lookVector
  487. end
  488.  
  489. if s.z < 0 then
  490. return cf.lookVector
  491. elseif s.z > 0 then
  492. return -cf.lookVector
  493. end
  494. end
  495.  
  496. function module.debounce(func)
  497. local debounce = false
  498. return function(...)
  499. if not debounce then
  500. debounce = true
  501. func(...)
  502. debounce = false
  503. end
  504. end
  505. end
  506.  
  507. function module.part(p)
  508. local parts = {}
  509. local function getParts(m)
  510. for _,v in pairs(m:GetChildren()) do
  511. if v:IsA("Part") and v ~= p then
  512. table.insert(parts,#parts+1,v)
  513. elseif v:IsA("Model") then
  514. getParts(v)
  515. end
  516. end
  517. end
  518. getParts(game.Workspace)
  519. local winner = {}
  520. for _,q in pairs(parts) do
  521. local mag = (q.Position-p.Position).magnitude
  522. if mag < winner[1] then
  523. winner[1] = mag
  524. winner[2] = q
  525. end
  526. end
  527. return winner[2]
  528. end
  529.  
  530. function module.weld(p1,p2)
  531. local w = Instance.new("Weld")
  532. w.Part0 = p1
  533. w.Part1 = p2
  534. w.C0 = p1.CFrame:inverse() * p2.CFrame
  535. w.Parent = p1
  536. return w
  537. end
  538. return module
  539. end))
  540. Configuration5.Name = "Settings"
  541. Configuration5.Parent = Tool0
  542. NumberValue6.Name = "PortalPower"
  543. NumberValue6.Parent = Configuration5
  544. NumberValue6.Value = 1
  545. NumberValue7.Name = "CameraWait"
  546. NumberValue7.Parent = Configuration5
  547. NumberValue7.Value = 0.65
  548. BoolValue8.Name = "CanGrab"
  549. BoolValue8.Parent = Configuration5
  550. BoolValue8.Value = true
  551. NumberValue9.Name = "GrabPower"
  552. NumberValue9.Parent = Configuration5
  553. NumberValue9.Value = 100
  554. NumberValue10.Name = "GrabRange"
  555. NumberValue10.Parent = Configuration5
  556. NumberValue10.Value = 5
  557. Sound11.Name = "Fire"
  558. Sound11.Parent = Tool0
  559. Sound11.SoundId = "rbxassetid://142774034"
  560. LocalScript12.Name = "MouseIcon"
  561. LocalScript12.Parent = Tool0
  562. table.insert(cors,sandbox(LocalScript12,function()
  563. local MOUSE_ICON = 'rbxassetid://120192974' local Tool = script.Parent
  564. local Mouse = nil local function UpdateIcon()
  565. if Mouse then Mouse.Icon = Tool.Enabled and MOUSE_ICON end end local function OnEquipped(mouse) Mouse = mouse UpdateIcon() end local function OnChanged(property)
  566. if property == 'Enabled' then UpdateIcon() end end Tool.Equipped:connect(OnEquipped) Tool.Changed:connect(OnChanged)
  567.  
  568. end))
  569. LocalScript12.Disabled = true
  570. Camera13.Name = "ThumbnailCamera"
  571. Camera13.Parent = Tool0
  572. Camera13.CFrame = CFrame.new(-122.698433, 1.56488907, 9.07953835, -0.740325332, -0.0495854728, 0.670417547, -0, 0.997275949, 0.0737605989, -0.672248781, 0.05460684, -0.738308668)
  573. Camera13.CoordinateFrame = CFrame.new(-122.698433, 1.56488907, 9.07953835, -0.740325332, -0.0495854728, 0.670417547, -0, 0.997275949, 0.0737605989, -0.672248781, 0.05460684, -0.738308668)
  574. Camera13.FieldOfView = 30
  575. Camera13.Focus = CFrame.new(-124.039268, 1.41736782, 10.5561562, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  576. Camera13.focus = CFrame.new(-124.039268, 1.41736782, 10.5561562, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  577. for i,v in pairs(mas:GetChildren()) do
  578. v.Parent = script
  579. pcall(function() v:MakeJoints() end)
  580. end
  581. mas:Destroy()
  582. for i,v in pairs(cors) do
  583. spawn(function()
  584. pcall(v)
  585. end)
  586. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement