DaOMEGAa32

fe santiago

Oct 20th, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.28 KB | None | 0 0
  1. --https://github.com/Mokiros/roblox-FE-compatibility
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player,game,owner = owner,game
  4. local RealPlayer = Player
  5. do
  6. print("FE Compatibility code V2 by Mokiros")
  7. local RealPlayer = RealPlayer
  8. script.Parent = RealPlayer.Character
  9.  
  10. --Fake event to make stuff like Mouse.KeyDown work
  11. local Disconnect_Function = function(this)
  12. this[1].Functions[this[2]] = nil
  13. end
  14. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  15. local FakeEvent_Metatable = {__index={
  16. Connect = function(this,f)
  17. local i = tostring(math.random(0,10000))
  18. while this.Functions[i] do
  19. i = tostring(math.random(0,10000))
  20. end
  21. this.Functions[i] = f
  22. return setmetatable({this,i},Disconnect_Metatable)
  23. end
  24. }}
  25. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  26. local function fakeEvent()
  27. return setmetatable({Functions={}},FakeEvent_Metatable)
  28. end
  29.  
  30. --Creating fake input objects with fake variables
  31. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  32. FakeMouse.keyUp = FakeMouse.KeyUp
  33. FakeMouse.keyDown = FakeMouse.KeyDown
  34. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  35. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  36. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  37. end}
  38. --Merged 2 functions into one by checking amount of arguments
  39. CAS.UnbindAction = CAS.BindAction
  40.  
  41. --This function will trigger the events that have been :Connect()'ed
  42. local function TriggerEvent(self,ev,...)
  43. for _,f in pairs(self[ev].Functions) do
  44. f(...)
  45. end
  46. end
  47. FakeMouse.TriggerEvent = TriggerEvent
  48. UIS.TriggerEvent = TriggerEvent
  49.  
  50. --Client communication
  51. local Event = Instance.new("RemoteEvent")
  52. Event.Name = "UserInput_Event"
  53. Event.OnServerEvent:Connect(function(plr,io)
  54. if plr~=RealPlayer then return end
  55. FakeMouse.Target = io.Target
  56. FakeMouse.Hit = io.Hit
  57. if not io.isMouse then
  58. local b = io.UserInputState == Enum.UserInputState.Begin
  59. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  60. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  61. end
  62. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  63. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  64. end
  65. for _,t in pairs(CAS.Actions) do
  66. for _,k in pairs(t.Keys) do
  67. if k==io.KeyCode then
  68. t.Function(t.Name,io.UserInputState,io)
  69. end
  70. end
  71. end
  72. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  73. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  74. end
  75. end)
  76. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  77. local Mouse = owner:GetMouse()
  78. local UIS = game:GetService("UserInputService")
  79. local input = function(io,RobloxHandled)
  80. if RobloxHandled then return end
  81. --Since InputObject is a client-side instance, we create and pass table instead
  82. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  83. end
  84. UIS.InputBegan:Connect(input)
  85. UIS.InputEnded:Connect(input)
  86.  
  87. local h,t
  88. --Give the server mouse data every second frame, but only if the values changed
  89. --If player is not moving their mouse, client won't fire events
  90. local HB = game:GetService("RunService").Heartbeat
  91. while true do
  92. if h~=Mouse.Hit or t~=Mouse.Target then
  93. h,t=Mouse.Hit,Mouse.Target
  94. Event:FireServer({isMouse=true,Target=t,Hit=h})
  95. end
  96. --Wait 2 frames
  97. for i=1,2 do
  98. HB:Wait()
  99. end
  100. end]==],script)
  101.  
  102. ----Sandboxed game object that allows the usage of client-side methods and services
  103. --Real game object
  104. local RealGame = game
  105.  
  106. --Metatable for fake service
  107. local FakeService_Metatable = {
  108. __index = function(self,k)
  109. local s = rawget(self,"_RealService")
  110. if s then
  111. return typeof(s[k])=="function"
  112. and function(_,...)return s[k](s,...)end or s[k]
  113. end
  114. end,
  115. __newindex = function(self,k,v)
  116. local s = rawget(self,"_RealService")
  117. if s then s[k]=v end
  118. end
  119. }
  120. local function FakeService(t,RealService)
  121. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  122. return setmetatable(t,FakeService_Metatable)
  123. end
  124.  
  125. --Fake game object
  126. local FakeGame = {
  127. GetService = function(self,s)
  128. return rawget(self,s) or RealGame:GetService(s)
  129. end,
  130. Players = FakeService({
  131. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  132. },"Players"),
  133. UserInputService = FakeService(UIS,"UserInputService"),
  134. ContextActionService = FakeService(CAS,"ContextActionService"),
  135. RunService = FakeService({
  136. _btrs = {},
  137. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  138. BindToRenderStep = function(self,name,_,fun)
  139. self._btrs[name] = self.Heartbeat:Connect(fun)
  140. end,
  141. UnbindFromRenderStep = function(self,name)
  142. self._btrs[name]:Disconnect()
  143. end,
  144. },"RunService")
  145. }
  146. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  147. FakeGame.service = FakeGame.GetService
  148. FakeService(FakeGame,game)
  149. --Changing owner to fake player object to support owner:GetMouse()
  150. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  151. end
  152.  
  153. local s = Instance.new("Sound")
  154.  
  155. s.Name = "pamtri"
  156. s.SoundId = "rbxassetid://1031137209"
  157. s.Volume = 4
  158. s.Looped = true
  159. s.archivable = false
  160.  
  161. s.Parent = game.Workspace
  162.  
  163. wait(0.2)
  164.  
  165. s:play()
  166. local Plr = game.Players.LocalPlayer
  167. local PChar = Plr.Character
  168. local plr = game:GetService("Players").LocalPlayer
  169. local char = plr.Character
  170.  
  171. function FindInTable(t, n)
  172. for i,v in pairs(t) do
  173. if v == n then
  174. return true
  175. end
  176. end
  177. return false
  178. end
  179. --Transformaaaaation--
  180. char["Left Arm"].BrickColor = BrickColor.new("Pastel brown")
  181. char["Right Arm"].BrickColor = BrickColor.new("Pastel brown")
  182. char.Head.BrickColor = BrickColor.new("Pastel brown")
  183. char["Left Leg"].BrickColor = BrickColor.new("Pastel brown")
  184. char["Right Leg"].BrickColor = BrickColor.new("Pastel brown")
  185.  
  186. for i,v in pairs(char:children'') do
  187. local toremove = {"CharacterMesh", "Shirt", "Pants", "ShirtGraphic", "Accessory"}
  188. if FindInTable(toremove, v.ClassName) then v:Destroy() end
  189. if v.ClassName == "BodyColors" then
  190. v.HeadColor = BrickColor.new("Lily white")
  191. v.LeftArmColor = BrickColor.new("Lily white")
  192. v.LeftLegColor = BrickColor.new("Lily white")
  193. v.RightArmColor = BrickColor.new("Lily white")
  194. v.RightLegColor = BrickColor.new("Lily white")
  195. v.TorsoColor = BrickColor.new("Lily white")
  196. end
  197. end
  198.  
  199. local face = char.Head:FindFirstChild'face' if face then face.Texture = "http://www.roblox.com/asset/?id=329939455" end
  200. Instance.new("Shirt", char).ShirtTemplate = "http://www.roblox.com/asset/?id=216962370"
  201. Instance.new("Pants", char).PantsTemplate = "http://www.roblox.com/asset/?id=382537568"
  202. local function CreateHat(name, meshid, textureid)
  203. local h = Instance.new("Accessory")
  204. h.Name = name
  205. local han = Instance.new("Part", h)
  206. han.Name = "Handle"
  207. local mesh = Instance.new("SpecialMesh", han)
  208. mesh.Name = "Mesh"
  209. mesh.MeshId = meshid
  210. mesh.TextureId = textureid
  211. return h,han,mesh
  212. end
  213. hum = char:FindFirstChildOfClass'Humanoid'
  214. local h,han,mesh = CreateHat("2LEGITOwl", "http://www.roblox.com/asset/?id=0", "http://www.roblox.com/asset/?id=0")
  215. han.Size = Vector3.new(1, 1, 1)
  216. mesh.Scale = Vector3.new(0.3, 0.3, 0.3)
  217. h.AttachmentPos = Vector3.new(1.1, 0.38, 0)
  218. hum:AddAccessory(h)
  219. h,han,mesh = CreateHat("RobloxScarf", "http://www.roblox.com/asset/?id=0", "http://www.roblox.com/asset/?id=0")
  220. mesh.Scale = Vector3.new(3, 3, 3)
  221. han.Size = Vector3.new(1.9, 2, 2)
  222. h.AttachmentPos = Vector3.new(0, 1.54, 0.1)
  223. hum:AddAccessory(h)
  224. h,han,mesh = CreateHat("Beautiful Hair for Purple People", "http://www.roblox.com/asset/?id=87529", "http://www.roblox.com/asset/?id=1768566787623956")
  225. mesh.Scale = Vector3.new(1.05, 1.05, 1.05)
  226. han.Size = Vector3.new(2, 2, 2)
  227. hum:AddAccessory(h)
  228. --a function--
  229. function Say(text)
  230. local head = char.Head
  231. local fh = head:Clone()
  232. fh:ClearAllChildren()
  233. fh.Transparency = 1
  234. local bg = Instance.new("BillboardGui", fh)
  235. bg.Size = UDim2.new(6, 0, 6, 0)
  236. bg.StudsOffset = Vector3.new(0, 3, 0)
  237. local f = Instance.new("Frame", bg)
  238. f.Size = UDim2.new(1, 0, 1, 0)
  239. f.BackgroundTransparency = 1
  240. local tl = Instance.new("TextLabel", f)
  241. tl.BackgroundTransparency = 1
  242. tl.Size = UDim2.new(5, 0, 1, 0)
  243. tl.Position = UDim2.new(-2, 0, 0)
  244. tl.TextColor3 = Color3.new(1, 1, 1)
  245. tl.TextScaled = true
  246. tl.Text = ""
  247. tl.TextColor3 = BrickColor.new("Really black").Color
  248. tl.Font = Enum.Font.Fantasy
  249. tl.TextSize = 120
  250. fh.Parent = Instance.new("Model", plr.Character)
  251. local Joint = Instance.new("Weld", game.JointsService)
  252. Joint.Part0 = head
  253. Joint.Part1 = fh
  254.  
  255. local letters = {}
  256. text:gsub(".",function(c) table.insert(letters,c) end)
  257. for i,v in pairs(letters) do
  258. tl.Text = tl.Text .. tostring(v)
  259. wait(1/20)
  260. end
  261. wait(1)
  262. fh.Parent:Destroy()
  263. end
  264.  
  265. function ReloadChat() --hax
  266. local chat = plr:FindFirstChildOfClass'PlayerGui':FindFirstChild'SB_Chat'
  267. if chat then
  268. chat:Destroy()
  269. end
  270. plr.PlayerScripts.ChatScript:Destroy()
  271. game:GetService("Chat").ChatScript:Clone().Parent = plr.PlayerScripts
  272. plr:FindFirstChildOfClass'PlayerGui':WaitForChild'Chat'.Name = "SB_Chat"
  273. end
  274. local s = Instance.new("Sound")
  275.  
  276. s.Name = "pamtri"
  277. s.SoundId = "rbxassetid://874084114"
  278. s.Volume = 7
  279. s.Looped = false
  280. s.archivable = false
  281.  
  282. s.Parent = game.Workspace
  283.  
  284. wait(0.2)
  285.  
  286. s:play()
  287.  
  288. --Converted with ttyyuu12345's model to script plugin v4
  289. function sandbox(var,func)
  290. local env = getfenv(func)
  291. local newenv = setmetatable({},{
  292. __index = function(self,k)
  293. if k=="script" then
  294. return var
  295. else
  296. return env[k]
  297. end
  298. end,
  299. })
  300. setfenv(func,newenv)
  301. return func
  302. end
  303. cors = {}
  304. mas = Instance.new("Model",game:GetService("Lighting"))
  305. Tool0 = Instance.new("Tool")
  306. LocalScript1 = Instance.new("LocalScript")
  307. NumberValue2 = Instance.new("NumberValue")
  308. LocalScript3 = Instance.new("LocalScript")
  309. Script4 = Instance.new("Script")
  310. Script5 = Instance.new("Script")
  311. Part6 = Instance.new("Part")
  312. Sound7 = Instance.new("Sound")
  313. Sound8 = Instance.new("Sound")
  314. Sound9 = Instance.new("Sound")
  315. Part10 = Instance.new("Part")
  316. Tool0.Name = "Pamtri Gun -(6)"
  317. Tool0.Parent = mas
  318. Tool0.Grip = CFrame.new(0, 0, 0, -0.0050099371, 0, 0.999987423, 0, 1, 0, -0.999987423, 0, -0.0050099371)
  319. Tool0.GripForward = Vector3.new(-0.999987423, -0, 0.0050099371)
  320. Tool0.GripRight = Vector3.new(-0.0050099371, 0, -0.999987423)
  321. LocalScript1.Name = "Local Gui"
  322. LocalScript1.Parent = Tool0
  323. table.insert(cors,sandbox(LocalScript1,function()
  324. -------------------------------------Gun info
  325. ToolName="Pamtri Gun"
  326.  
  327. ClipSize=6
  328. ReloadTime=3
  329. Firerate=.40
  330. MinSpread=0
  331. MaxSpread=0
  332. SpreadRate=0
  333. BaseDamage=100
  334. automatic=false
  335. burst=false
  336. shot=true --Shotgun
  337. BarrlePos=Vector3.new(-2.20,.60,0)
  338. Cursors={"rbxasset://textures\\GunCursor.png"}
  339. ReloadCursor="rbxasset://textures\\GunWaitCursor.png"
  340. -------------------------------------
  341. equiped=false
  342. sp=script.Parent
  343. RayLength=1000
  344. Spread=0
  345. enabled=true
  346. reloading=false
  347. down=false
  348. r=game:service("RunService")
  349. last=0
  350. last2=0
  351. last3=0
  352. last4=0
  353. last5=0
  354. last6=0
  355.  
  356. Bullet=Instance.new("Part")
  357. Bullet.Name="Bullet"
  358. Bullet.BrickColor=BrickColor.new("New Yeller")
  359. Bullet.Anchored=true
  360. Bullet.CanCollide=false
  361. Bullet.Locked=true
  362. Bullet.Size=Vector3.new(1,1,1)
  363. --Bullet.Transparency=.65
  364. Bullet.formFactor=0
  365. Bullet.TopSurface=0
  366. Bullet.BottomSurface=0
  367. mesh=Instance.new("SpecialMesh")
  368. mesh.Parent=Bullet
  369. mesh.MeshType="Brick"
  370. mesh.Name="Mesh"
  371. mesh.Scale=Vector3.new(.15,.15,1)
  372.  
  373. function check()
  374. sp.Name=ToolName.."-("..tostring(sp.Ammo.Value)..")"
  375. end
  376.  
  377. function computeDirection(vec)
  378. local lenSquared = vec.magnitude * vec.magnitude
  379. local invSqrt = 1 / math.sqrt(lenSquared)
  380. return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt)
  381. end
  382.  
  383. ------------------------------------------------------------------------------------Raycasting functions
  384. function cross(vector1, vector2)
  385. return Vector3.new(vector1.y * vector2.z - vector2.y * vector1.z, vector1.z * vector2.x - vector1.x * vector2.z, vector1.x * vector2.y - vector2.x * vector1.y)
  386. end
  387. function dot(vector1, vector2)
  388. return (vector1.x * vector2.x + vector1.y * vector2.y + vector1.z * vector2.z)
  389. end
  390. function getLineSphereCollide(linePoint1, lineVector, sphereCenter, radius)
  391. local a = lineVector.x * lineVector.x + lineVector.y * lineVector.y + lineVector.z * lineVector.z
  392. local b = lineVector.x * (linePoint1.x - sphereCenter.x) + lineVector.y * (linePoint1.y - sphereCenter.y) + lineVector.z * (linePoint1.z - sphereCenter.z)
  393. local c = (linePoint1.x - sphereCenter.x) * (linePoint1.x - sphereCenter.x) + (linePoint1.y - sphereCenter.y) * (linePoint1.y - sphereCenter.y) + (linePoint1.z - sphereCenter.z) * (linePoint1.z - sphereCenter.z) - radius * radius
  394. if (a > 0) and (b * b >= a * c) then
  395. local diff = math.sqrt(b * b - a * c)
  396. return ((-b - diff) / a), ((diff - b) / a)
  397. else
  398. return -1, -1
  399. end
  400. end
  401. --Returns hit, position, normal, time
  402. function raycast(model, start, vector, brickFunction)
  403. local hit, normal, time = raycastRecursive(model, start, vector, brickFunction, vector.unit, dot(start, vector.unit))
  404. if (dot(normal, vector) > 0) then
  405. normal = -normal
  406. end
  407. return hit, start + time * vector, normal.unit, time
  408. end
  409. function raycastRecursive(model, start, vector, brickFunction, unitVec, startDist)
  410. if (model.className == "Part") or (model.className == "Seat") or (model.className =="SpawnLocation") then
  411. local range = model.Size.magnitude / 2
  412. local dist = dot(model.Position, unitVec) - startDist
  413. if (dist + range > 0) and (dist - range < vector.magnitude) and ((dist * unitVec + start - model.Position).magnitude < range) and brickFunction(model) then
  414. local halfSize = model.Size / 2
  415. if (model.Shape == Enum.PartType.Ball) then
  416. local time, timeMax = getLineSphereCollide(start, vector, model.Position, halfSize.x)
  417. if (time < 1) and (time >= 0) then
  418. return model, (time * vector + start - model.Position), time
  419. else
  420. return nil, Vector3.new(0, 0, 0), 1
  421. end
  422. elseif (model.Shape == Enum.PartType.Block) then
  423. local time = 1
  424. local cf = model.CFrame - model.Position
  425. local xvec = cf * Vector3.new(1, 0, 0)
  426. local yvec = cf * Vector3.new(0, 1, 0)
  427. local zvec = cf * Vector3.new(0, 0, 1)
  428. local xspd = -dot(xvec, vector)
  429. local yspd = -dot(yvec, vector)
  430. local zspd = -dot(zvec, vector)
  431. local xmin, xmax, ymin, ymax, zmin, zmax = -1
  432. local dotProd = dot(xvec, start - model.Position)
  433. if (xspd ~= 0) then
  434. xmin = (dotProd - halfSize.x) / xspd
  435. xmax = (dotProd + halfSize.x) / xspd
  436. if (xmax < xmin) then
  437. local swap = xmin
  438. xmin = xmax
  439. xmax = swap
  440. end
  441. else
  442. if (math.abs(dotProd) < halfSize.x) then
  443. xmax = 1
  444. xmin = 0
  445. else
  446. return nil, Vector3.new(0, 0, 0), 1
  447. end
  448. end
  449. local dotProd = dot(yvec, start - model.Position)
  450. if (yspd ~= 0) then
  451. ymin = (dotProd - halfSize.y) / yspd
  452. ymax = (dotProd + halfSize.y) / yspd
  453. if (ymax < ymin) then
  454. local swap = ymin
  455. ymin = ymax
  456. ymax = swap
  457. end
  458. else
  459. if (math.abs(dotProd) < halfSize.y) then
  460. ymax = 1
  461. ymin = 0
  462. else
  463. return nil, Vector3.new(0, 0, 0), 1
  464. end
  465. end
  466. local dotProd = dot(zvec, start - model.Position)
  467. if (zspd ~= 0) then
  468. zmin = (dotProd - halfSize.z) / zspd
  469. zmax = (dotProd + halfSize.z) / zspd
  470. if (zmax < zmin) then
  471. local swap = zmin
  472. zmin = zmax
  473. zmax = swap
  474. end
  475. else
  476. if (math.abs(dotProd) < halfSize.z) then
  477. zmax = 1
  478. zmin = 0
  479. else
  480. return nil, Vector3.new(0, 0, 0), 1
  481. end
  482. end
  483. if (xmin <= ymax) and (xmax >= ymin) and (xmin <= zmax) and (xmax >= zmin) and (zmin <= ymax) and (zmax >= ymin) then
  484. local normal = xvec
  485. local min = xmin
  486. if (ymin > min) then
  487. min = ymin
  488. normal = yvec
  489. end
  490. if (zmin > min) then
  491. min = zmin
  492. normal = zvec
  493. end
  494. if (min >= 0) and (min < 1) then
  495. time = min
  496. elseif (xmax > 0) and (ymax > 0) and (zmax > 0) and (min < 0) then
  497. time = 0
  498. normal = Vector3.new(0, 0, 0)
  499. end
  500. return model, normal, time
  501. else
  502. return nil, Vector3.new(0, 0, 0), 1
  503. end
  504. else -- Cylinder
  505. local time = 1
  506. local cf = model.CFrame - model.Position
  507. local xvec = cf * Vector3.new(1, 0, 0)
  508. local xspd = -dot(xvec, vector)
  509. local xmin, xmax = -1
  510. local dotProd = dot(xvec, start - model.Position)
  511. if (xspd ~= 0) then
  512. xmin = (dotProd - halfSize.x) / xspd
  513. xmax = (dotProd + halfSize.x) / xspd
  514. if (xmax < xmin) then
  515. local swap = xmin
  516. xmin = xmax
  517. xmax = swap
  518. end
  519. else
  520. if (math.abs(dotProd) < halfSize.x) then
  521. xmax = 1
  522. xmin = 0
  523. else
  524. return nil, Vector3.new(0, 0, 0), 1
  525. end
  526. end
  527.  
  528. local relVec = cf:pointToObjectSpace(vector) * Vector3.new(0, 1, 1)
  529. local relPos = model.CFrame:pointToObjectSpace(start) * Vector3.new(0, 1, 1)
  530. local rmin, rmax = getLineSphereCollide(relPos, relVec, Vector3.new(0, 0, 0), halfSize.y)
  531. if (xmin <= rmax) and (xmax >= rmin) and (rmax > 0) then
  532. local normal = xvec
  533. local min = xmin
  534. if (rmin > min) then
  535. min = rmin
  536. normal = cf * (relPos + relVec * min)
  537. end
  538. if (min >= 0) and (min < 1) then
  539. time = min
  540. elseif (xmax > 0) and (rmax > 0) and (min < 0) then
  541. time = 0
  542. normal = Vector3.new(0, 0, 0)
  543. end
  544. return model, normal, time
  545. else
  546. return nil, Vector3.new(0, 0, 0), 1
  547. end
  548. return nil, Vector3.new(0, 0, 0), 1
  549. end
  550. end
  551. return nil, Vector3.new(0, 0, 0), 1
  552. elseif (model.className=="Model") or (model.className=="Workspace") or (model.className=="Hat") or (model.className == "Tool") then
  553. local children=model:GetChildren()
  554. local time=1
  555. local normal=Vector3.new(0, 0, 0)
  556. local hit=nil
  557. for n = 1, #children do
  558. if children[n]~= nil then
  559. local newHit, newNormal, newTime = raycastRecursive(children[n], start, vector, brickFunction, unitVec, startDist)
  560. if (newTime < time) then
  561. time = newTime
  562. hit = newHit
  563. normal = newNormal
  564. end
  565. end
  566. end
  567. return hit, normal, time
  568. else
  569. return nil, Vector3.new(0, 0, 0), 1
  570. end
  571. end
  572. -------------------------------------------------------------------------------
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579. function tagHumanoid(humanoid)
  580. local plr=game.Players:playerFromCharacter(sp.Parent)
  581. if plr~=nil then
  582. local tag=Instance.new("ObjectValue")
  583. tag.Value=plr
  584. tag.Name="creator"
  585. tag.Parent=humanoid
  586. delay(2,function()
  587. if tag~=nil then
  588. tag.Parent=nil
  589. end
  590. end)
  591. end
  592. end
  593.  
  594.  
  595. function reload(mouse)
  596. reloading=true
  597. mouse.Icon=ReloadCursor
  598. while sp.Ammo.Value<ClipSize and reloading and enabled do
  599. wait(ReloadTime/ClipSize)
  600. if reloading then
  601. sp.Ammo.Value=sp.Ammo.Value+1
  602. check()
  603. else
  604. break
  605. end
  606. end
  607. check()
  608. mouse.Icon=Cursors[1]
  609. reloading=false
  610. end
  611.  
  612. function onKeyDown(key,mouse)
  613. key=key:lower()
  614. if key=="r" and not reloading then
  615. reload(mouse)
  616. end
  617. end
  618.  
  619. function movecframe(p,pos)
  620. p.Parent=game.Lighting
  621. p.Position=pos
  622. p.Parent=game.Workspace
  623. end
  624.  
  625.  
  626. function fire(aim)
  627. sp.Handle.Fire:Play()
  628.  
  629. t=r.Stepped:wait()
  630. last6=last5
  631. last5=last4
  632. last4=last3
  633. last3=last2
  634. last2=last
  635. last=t
  636.  
  637. local bullet=Bullet:clone()
  638. local totalDist=0
  639. Lengthdist=-RayLength/.5
  640. local startpoint=sp.Handle.CFrame*BarrlePos
  641. local dir=(aim)-startpoint
  642. dir=computeDirection(dir)
  643. local cfrm=CFrame.new(startpoint, dir+startpoint)
  644. local hit,pos,normal,time=raycast(game.Workspace, startpoint, cfrm*Vector3.new(0,0,Lengthdist)-startpoint, function(brick)
  645. if brick.Name=="Glass" then
  646. return true
  647. elseif brick.Name=="Bullet" or brick.Name=="BulletTexture" then
  648. return false
  649. elseif brick:IsDescendantOf(sp.Parent) then
  650. return false
  651. elseif brick.Name=="Handle" then
  652. if brick.Parent:IsDescendantOf(sp.Parent) then
  653. return false
  654. else
  655. return true
  656. end
  657. end
  658. return true
  659. end)
  660. bullet.Parent=game.Workspace
  661. if hit~=nil then
  662. local humanoid=hit.Parent:FindFirstChild("Humanoid")
  663. if humanoid~=nil then
  664. local damage=math.random(BaseDamage-(BaseDamage*.25),BaseDamage+(BaseDamage*.25))
  665. if hit.Name=="Head" then
  666. damage=damage*1.3
  667. elseif hit.Name=="Torso" then
  668. else
  669. damage=damage*.75
  670. end
  671. if humanoid.Health>0 then
  672. local eplr=game.Players:playerFromCharacter(humanoid.Parent)
  673. local plr=game.Players:playerFromCharacter(sp.Parent)
  674. if eplr~=nil and plr~=nil then
  675. -- if eplr.TeamColor~=plr.TeamColor or eplr.Neutral or plr.Neutral then
  676. tagHumanoid(humanoid)
  677. humanoid:TakeDamage(damage)
  678. -- end
  679. else
  680. tagHumanoid(humanoid)
  681. humanoid:TakeDamage(damage)
  682. end
  683. end
  684. end
  685. if (hit.Name == "Part10") or (hit.Name == "Part11") or (hit.Name == "Part21") or (hit.Name == "Part23") or (hit.Name == "Part24") or (hit.Name == "Part8") then
  686. rand = math.random(1,5)
  687. if rand == 3 then
  688. workspace.GlassSound:play()
  689. hit:breakJoints()
  690. end
  691. end
  692. if (hit.Parent:findFirstChild("Hit")) then
  693. hit.Parent.Health.Value = hit.Parent.Health.Value - BaseDamage/3
  694. end
  695. distance=(startpoint-pos).magnitude
  696. bullet.CFrame=cfrm*CFrame.new(0,0,-distance/2)
  697. bullet.Mesh.Scale=Vector3.new(.15,.15,distance)
  698. else
  699. bullet.CFrame=cfrm*CFrame.new(0,0,-RayLength/2)
  700. bullet.Mesh.Scale=Vector3.new(.15,.15,RayLength)
  701. end
  702. if pos~=nil then
  703. end
  704. local deb=game:FindFirstChild("Debris")
  705. if deb==nil then
  706. local debris=Instance.new("Debris")
  707. debris.Parent=game
  708. end
  709. check()
  710. game.Debris:AddItem(bullet,.05)
  711. end
  712.  
  713. function onButton1Up(mouse)
  714. down=false
  715. end
  716.  
  717. function onButton1Down(mouse)
  718. h=sp.Parent:FindFirstChild("Humanoid")
  719. if not enabled or reloading or down or h==nil then
  720. return
  721. end
  722. if sp.Ammo.Value>0 and h.Health>0 then
  723. --[[if sp.Ammo.Value<=0 then
  724. if not reloading then
  725. reload(mouse)
  726. end
  727. return
  728. end]]
  729. down=true
  730. enabled=false
  731. while down do
  732. if sp.Ammo.Value<=0 then
  733. break
  734. end
  735. if burst then
  736. local startpoint=sp.Handle.CFrame*BarrlePos
  737. local mag=(mouse.Hit.p-startpoint).magnitude
  738. local rndm=Vector3.new(math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag))
  739. fire(mouse.Hit.p+rndm)
  740. sp.Ammo.Value=sp.Ammo.Value-1
  741. if sp.Ammo.Value<=0 then
  742. break
  743. end
  744. wait(.05)
  745. local startpoint=sp.Handle.CFrame*BarrlePos
  746. local mag2=((mouse.Hit.p+rndm)-startpoint).magnitude
  747. local rndm2=Vector3.new(math.random(-(.1/10)*mag2,(.1/10)*mag2),math.random(-(.1/10)*mag2,(.1/10)*mag2),math.random(-(.1/10)*mag2,(.1/10)*mag2))
  748. fire(mouse.Hit.p+rndm+rndm2)
  749. sp.Ammo.Value=sp.Ammo.Value-1
  750. if sp.Ammo.Value<=0 then
  751. break
  752. end
  753. wait(.05)
  754. fire(mouse.Hit.p+rndm+rndm2+rndm2)
  755. sp.Ammo.Value=sp.Ammo.Value-1
  756. elseif shot then
  757. sp.Ammo.Value=sp.Ammo.Value-1
  758. local startpoint=sp.Handle.CFrame*BarrlePos
  759. local mag=(mouse.Hit.p-startpoint).magnitude
  760. local rndm=Vector3.new(math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag))
  761. fire(mouse.Hit.p+rndm)
  762. local mag2=((mouse.Hit.p+rndm)-startpoint).magnitude
  763. local rndm2=Vector3.new(math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2))
  764. fire(mouse.Hit.p+rndm+rndm2)
  765. local rndm3=Vector3.new(math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2))
  766. fire(mouse.Hit.p+rndm+rndm3)
  767. local rndm4=Vector3.new(math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2))
  768. fire(mouse.Hit.p+rndm+rndm4)
  769. else
  770. sp.Ammo.Value=sp.Ammo.Value-1
  771. local startpoint=sp.Handle.CFrame*BarrlePos
  772. local mag=(mouse.Hit.p-startpoint).magnitude
  773. local rndm=Vector3.new(math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag))
  774. fire(mouse.Hit.p+rndm)
  775. end
  776. wait(Firerate)
  777. if not automatic then
  778. break
  779. end
  780. end
  781. enabled=true
  782. else
  783. sp.Handle.Trigger:Play()
  784. end
  785. end
  786.  
  787. function onEquippedLocal(mouse)
  788. if mouse==nil then
  789. print("Mouse not found")
  790. return
  791. end
  792. mouse.Icon=Cursors[1]
  793. mouse.KeyDown:connect(function(key) onKeyDown(key,mouse) end)
  794. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  795. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  796. check()
  797. equiped=true
  798. if #Cursors>1 then
  799. while equiped do
  800. t=r.Stepped:wait()
  801. local action=sp.Parent:FindFirstChild("Pose")
  802. if action~=nil then
  803. if sp.Parent.Pose.Value=="Standing" then
  804. Spread=MinSpread
  805. else
  806. Spread=MinSpread+((4/10)*(MaxSpread-MinSpread))
  807. end
  808. else
  809. Spread=MinSpread
  810. end
  811. if t-last<SpreadRate then
  812. Spread=Spread+.1*(MaxSpread-MinSpread)
  813. end
  814. if t-last2<SpreadRate then
  815. Spread=Spread+.1*(MaxSpread-MinSpread)
  816. end
  817. if t-last3<SpreadRate then
  818. Spread=Spread+.1*(MaxSpread-MinSpread)
  819. end
  820. if t-last4<SpreadRate then
  821. Spread=Spread+.1*(MaxSpread-MinSpread)
  822. end
  823. if t-last5<SpreadRate then
  824. Spread=Spread+.1*(MaxSpread-MinSpread)
  825. end
  826. if t-last6<SpreadRate then
  827. Spread=Spread+.1*(MaxSpread-MinSpread)
  828. end
  829. if not reloading then
  830. local percent=(Spread-MinSpread)/(MaxSpread-MinSpread)
  831. for i=0,#Cursors-1 do
  832. if percent>(i/(#Cursors-1))-((1/(#Cursors-1))/2) and percent<(i/(#Cursors-1))+((1/(#Cursors-1))/2) then
  833. mouse.Icon=Cursors[i+1]
  834. end
  835. end
  836. end
  837. wait(Firerate*.9)
  838. end
  839. end
  840. end
  841. function onUnequippedLocal(mouse)
  842. equiped=false
  843. reloading=false
  844. end
  845. sp.Equipped:connect(onEquippedLocal)
  846. sp.Unequipped:connect(onUnequippedLocal)
  847. check()
  848. end))
  849. NumberValue2.Name = "Ammo"
  850. NumberValue2.Parent = Tool0
  851. NumberValue2.Value = 6
  852. LocalScript3.Name = "BackupWeld"
  853. LocalScript3.Parent = Tool0
  854. table.insert(cors,sandbox(LocalScript3,function()
  855. function Weld(x,y)
  856. local W = Instance.new("Weld")
  857. W.Part0 = x
  858. W.Part1 = y
  859. local CJ = CFrame.new(x.Position)
  860. local C0 = x.CFrame:inverse()*CJ
  861. local C1 = y.CFrame:inverse()*CJ
  862. W.C0 = C0
  863. W.C1 = C1
  864. W.Parent = x
  865. end
  866.  
  867. function Get(A)
  868. if A.className == "Part" then
  869. Weld(script.Parent.Handle, A)
  870. A.Anchored = false
  871. else
  872. local C = A:GetChildren()
  873. for i=1, #C do
  874. Get(C[i])
  875. end
  876. end
  877. end
  878.  
  879. function Finale()
  880. Get(script.Parent)
  881. end
  882.  
  883. script.Parent.Equipped:connect(Finale)
  884. script.Parent.Unequipped:connect(Finale)
  885. Finale()
  886. end))
  887. Script4.Name = "Welding"
  888. Script4.Parent = Tool0
  889. table.insert(cors,sandbox(Script4,function()
  890. function Weld(x,y)
  891. local W = Instance.new("Weld")
  892. W.Part0 = x
  893. W.Part1 = y
  894. local CJ = CFrame.new(x.Position)
  895. local C0 = x.CFrame:inverse()*CJ
  896. local C1 = y.CFrame:inverse()*CJ
  897. W.C0 = C0
  898. W.C1 = C1
  899. W.Parent = x
  900. end
  901.  
  902. function Get(A)
  903. if A.className == "Part" then
  904. Weld(script.Parent.Handle, A)
  905. A.Anchored = false
  906. else
  907. local C = A:GetChildren()
  908. for i=1, #C do
  909. Get(C[i])
  910. end
  911. end
  912. end
  913.  
  914. function Finale()
  915. Get(script.Parent)
  916. end
  917.  
  918. script.Parent.Equipped:connect(Finale)
  919. script.Parent.Unequipped:connect(Finale)
  920. Finale()
  921. end))
  922. Script5.Name = "SandwichScript"
  923. Script5.Parent = Tool0
  924. table.insert(cors,sandbox(Script5,function()
  925. local Tool = script.Parent;
  926.  
  927. function onEquipped()
  928. Tool.Handle.OpenSound:play()
  929. end
  930.  
  931. script.Parent.Equipped:connect(onEquipped)
  932.  
  933. end))
  934. Part6.Name = "Handle"
  935. Part6.Parent = Tool0
  936. Part6.CFrame = CFrame.new(2.15507817, 0.635000944, 7.03725863, 0.0523361303, 0, -0.998629212, 0, 1, 0, 0.998629212, 0, 0.0523361303)
  937. Part6.Orientation = Vector3.new(0, -87, 0)
  938. Part6.Position = Vector3.new(2.15507817, 0.635000944, 7.03725863)
  939. Part6.Rotation = Vector3.new(0, -87, 0)
  940. Part6.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  941. Part6.Size = Vector3.new(0.5, 0.729999959, 0.5)
  942. Part6.BottomSurface = Enum.SurfaceType.Smooth
  943. Part6.BrickColor = BrickColor.new("Really black")
  944. Part6.Material = Enum.Material.SmoothPlastic
  945. Part6.TopSurface = Enum.SurfaceType.Smooth
  946. Part6.brickColor = BrickColor.new("Really black")
  947. Sound7.Name = "Fire"
  948. Sound7.Parent = Part6
  949. Sound7.Pitch = 0.89999997615814
  950. Sound7.PlaybackSpeed = 0.89999997615814
  951. Sound7.SoundId = "http://roblox.com/asset/?id=10209859"
  952. Sound7.Volume = 1
  953. Sound8.Name = "OpenSound"
  954. Sound8.Parent = Part6
  955. Sound8.SoundId = "rbxassetid://874084114"
  956. Sound8.Volume = 1
  957. Sound9.Name = "Trigger"
  958. Sound9.Parent = Part6
  959. Sound9.SoundId = "rbxasset://sounds//switch.wav"
  960. Sound9.Volume = 0.75
  961. Part10.Parent = Tool0
  962. Part10.CFrame = CFrame.new(2.12550807, 1.25000095, 6.47303295, 0.0523361452, 0, -0.998629451, 0, 1, 0, 0.998629451, 0, 0.0523361452)
  963. Part10.Orientation = Vector3.new(0, -87, 0)
  964. Part10.Position = Vector3.new(2.12550807, 1.25000095, 6.47303295)
  965. Part10.Rotation = Vector3.new(0, -87, 0)
  966. Part10.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  967. Part10.Size = Vector3.new(1.63, 0.5, 0.5)
  968. Part10.BottomSurface = Enum.SurfaceType.Smooth
  969. Part10.BrickColor = BrickColor.new("Really black")
  970. Part10.Material = Enum.Material.SmoothPlastic
  971. Part10.TopSurface = Enum.SurfaceType.Smooth
  972. Part10.brickColor = BrickColor.new("Really black")
  973. for i,v in pairs(mas:GetChildren()) do
  974. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  975. pcall(function() v:MakeJoints() end)
  976. end
  977. mas:Destroy()
  978. for i,v in pairs(cors) do
  979. spawn(function()
  980. pcall(v)
  981. end)
  982. end
  983.  
  984. local Victim='xVortex_ray'
  985. local A=Instance.new'Animation'
  986. A.AnimationId='rbxassetid://4168310532'
  987. local P=game:GetService'Players'.LocalPlayer
  988. local C=P.Character or P.CharacterAdded:Wait()
  989. local H=C:WaitForChild'Humanoid':LoadAnimation(A)
  990. H:Play()
  991. H:AdjustSpeed(1)
  992. while wait(0.1) do
  993. C:WaitForChild'HumanoidRootPart'.CFrame=CFrame.new(game:GetService'Players':FindFirstChild(Victim).Character:WaitForChild'HumanoidRootPart'.Position)
  994. end
Add Comment
Please, Sign In to add comment