Advertisement
DarkScriptZEditors

Can

Jan 7th, 2019
443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.74 KB | None | 0 0
  1. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  2. local Player,game,owner = owner,game
  3. local RealPlayer = Player
  4. do
  5. print("FE Compatibility code by Mokiros")
  6. local rp = RealPlayer
  7. script.Parent = rp.Character
  8.  
  9. --RemoteEvent for communicating
  10. local Event = Instance.new("RemoteEvent")
  11. Event.Name = "UserInput_Event"
  12.  
  13. --Fake event to make stuff like Mouse.KeyDown work
  14. local function fakeEvent()
  15. local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
  16. t.connect = t.Connect
  17. return t
  18. end
  19.  
  20. --Creating fake input objects with fake variables
  21. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  22. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  23. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  24. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  25. end}
  26. --Merged 2 functions into one by checking amount of arguments
  27. CAS.UnbindAction = CAS.BindAction
  28.  
  29. --This function will trigger the events that have been :Connect()'ed
  30. local function te(self,ev,...)
  31. local t = m[ev]
  32. if t and t._fakeEvent then
  33. for _,f in pairs(t.Functions) do
  34. f(...)
  35. end
  36. end
  37. end
  38. m.TrigEvent = te
  39. UIS.TrigEvent = te
  40.  
  41. Event.OnServerEvent:Connect(function(plr,io)
  42. if plr~=rp then return end
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. if not io.isMouse then
  46. local b = io.UserInputState == Enum.UserInputState.Begin
  47. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  48. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  49. end
  50. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  51. return m:TrigEvent(b and "Button2Down" or "Button2Up")
  52. end
  53. for _,t in pairs(CAS.Actions) do
  54. for _,k in pairs(t.Keys) do
  55. if k==io.KeyCode then
  56. t.Function(t.Name,io.UserInputState,io)
  57. end
  58. end
  59. end
  60. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  61. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  62. end
  63. end)
  64. Event.Parent = NLS([==[
  65. local Player = game:GetService("Players").LocalPlayer
  66. local Event = script:WaitForChild("UserInput_Event")
  67. local Mouse = Player:GetMouse()
  68. local UIS = game:GetService("UserInputService")
  69. local input = function(io,a)
  70. if a then return end
  71. --Since InputObject is a client-side instance, we create and pass table instead
  72. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  73. end
  74. UIS.InputBegan:Connect(input)
  75. UIS.InputEnded:Connect(input)
  76. local h,t
  77. --Give the server mouse data 30 times every second, but only if the values changed
  78. --If player is not moving their mouse, client won't fire events
  79. while wait(1/30) do
  80. if h~=Mouse.Hit or t~=Mouse.Target then
  81. h,t=Mouse.Hit,Mouse.Target
  82. Event:FireServer({isMouse=true,Target=t,Hit=h})
  83. end
  84. end]==],Player.Character)
  85.  
  86. ----Sandboxed game object that allows the usage of client-side methods and services
  87. --Real game object
  88. local _rg = game
  89.  
  90. --Metatable for fake service
  91. local fsmt = {
  92. __index = function(self,k)
  93. local s = rawget(self,"_RealService")
  94. if s then
  95. return typeof(s[k])=="function"
  96. and function(_,...)return s[k](s,...)end or s[k]
  97. end
  98. end,
  99. __newindex = function(self,k,v)
  100. local s = rawget(self,"_RealService")
  101. if s then s[k]=v end
  102. end
  103. }
  104. local function FakeService(t,RealService)
  105. t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
  106. return setmetatable(t,fsmt)
  107. end
  108.  
  109. --Fake game object
  110. local g = {
  111. GetService = function(self,s)
  112. return rawget(self,s) or _rg:GetService(s)
  113. end,
  114. Players = FakeService({
  115. LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
  116. },"Players"),
  117. UserInputService = FakeService(UIS,"UserInputService"),
  118. ContextActionService = FakeService(CAS,"ContextActionService"),
  119. RunService = FakeService({
  120. _btrs = {},
  121. RenderStepped = _rg:GetService("RunService").Heartbeat,
  122. BindToRenderStep = function(self,name,_,fun)
  123. self._btrs[name] = self.Heartbeat:Connect(fun)
  124. end,
  125. UnbindFromRenderStep = function(self,name)
  126. self._btrs[name]:Disconnect()
  127. end,
  128. },"RunService")
  129. }
  130. rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
  131. g.service = g.GetService
  132. FakeService(g,game)
  133. --Changing owner to fake player object to support owner:GetMouse()
  134. game,owner = g,g.Players.LocalPlayer
  135. end
  136. plr=game:service'Players'.LocalPlayer ch=plr.Character tor,torso,rootpart,rj=ch.Torso,ch.Torso,ch.HumanoidRootPart,ch.HumanoidRootPart.RootJoint m,mouse=plr:GetMouse(),plr:GetMouse() cfn,ang,mr,int=CFrame.new,CFrame.Angles,math.rad,Instance.new clr='White' sz=0.2 mag=0.5 undotable={} if ch:findFirstChild("Draw") then ch.Draw:Destroy() end local tube=int("Model",ch) tube.Name='Draw' getSound=function(id) local s=int("Sound",ch.Head) s.Volume=1 s.SoundId=id return s end local spray=getSound('rbxassetid://137065982') spray.Volume=0.5 Weld = function(p0,p1,x,y,z,rx,ry,rz,par) p0.Position = p1.Position local w = Instance.new('Motor',par or p0) w.Part0 = p1 w.Part1 = p0 w.C0 = CFrame.new(x or 0,y or 0,z or 0)*CFrame.Angles(rx or 0,ry or 0,rz or 0) w.MaxVelocity = .1 return w end weld=function(p0,p1,c0) local w=Instance.new("Weld",p0) w.Part0=p0 w.Part1=p1 w.C0=c0 return w end cp=function(parent,color,size,anchored,cancollide) local newp=Instance.new("Part",parent) newp.TopSurface='Smooth' newp.BottomSurface='Smooth' newp.FormFactor="Custom" newp.Material='SmoothPlastic' newp.BrickColor=BrickColor.new(color) newp.Size=size newp.Anchored=anchored newp.CanCollide=cancollide newp:BreakJoints() return newp end Tween = function(Weld, Stop, Step,a) ypcall(function() local func = function() local Start = Weld.C1 local X1, Y1, Z1 = Start:toEulerAnglesXYZ() local Stop = Stop local X2, Y2, Z2 = Stop:toEulerAnglesXYZ() for i = 0, 1, Step or .1 do Weld.C1 = CFrame.new( (Start.p.X * (1 - i)) + (Stop.p.X * i), (Start.p.Y * (1 - i)) + (Stop.p.Y * i), (Start.p.Z * (1 - i)) + (Stop.p.Z * i)) * CFrame.fromEulerAnglesXYZ( (X1 * (1 - i)) + (X2 * i), (Y1 * (1 - i)) + (Y2 * i), (Z1 * (1 - i)) + (Z2 * i) ) wait() end Weld.C1 = Stop end if a then coroutine.wrap(func)() else func() end end) end cyl=function(prt) local c=int("CylinderMesh",prt) return c end blo=function(prt) local c=int("BlockMesh",prt) return c end rabr = cp(tube,'White',Vector3.new(1,1,1),false,false) rabr.Transparency = 1 rabr.Name='Locker' rabr.Position = torso.Position rw = Weld(rabr,torso,1.5,.5,0,0,0,0) rw.Parent = tube rw.Name = 'rw' w = Instance.new("Weld",tube) w.Part0,w.Part1 = ch['Right Arm'],rabr w.C1 = CFrame.new(0,-.5,0) mh=cp(tube,"White",Vector3.new(0.6,1,0.6)) cyl(mh) mw=weld(ch['Right Arm'],mh,cfn(0,-1,0)*ang(mr(-90),0,0)) mha=cp(tube,"Really black",Vector3.new(0.6,0.2,0.6)) cyl(mha).Scale=Vector3.new(0.85,1,0.85) weld(mh,mha,cfn(0,0.6,0)) local pz=cp(tube,"White",Vector3.new(0.6,0.2,0.6)) cyl(pz).Scale=Vector3.new(0.9,0.4,0.9) weld(mha,pz,cfn(0,0,0)) local p=cp(tube,"Dark stone grey",Vector3.new(0.6,0.2,0.6)) cyl(p).Scale=Vector3.new(0.95,0.4,0.95) weld(mh,p,cfn(0,0.5,0)) local pa=cp(tube,"Dark stone grey",Vector3.new(0.6,0.3,0.6)) pa.Material='Plastic' cyl(pa).Scale=Vector3.new(1.1,1,1.1) weld(mh,pa,cfn(0,0,0)) local p=cp(tube,"Really black",Vector3.new(0.6,0.2,0.6)) p.Material='Plastic' cyl(p).Scale=Vector3.new(1.05,0.4,1.05) weld(pa,p,cfn(0,0.18,0)) local p=cp(tube,"Really black",Vector3.new(0.6,0.2,0.6)) p.Material='Plastic' cyl(p).Scale=Vector3.new(1.05,0.4,1.05) weld(pa,p,cfn(0,-0.18,0)) mha2=cp(tube,"White",Vector3.new(0.2,0.2,0.2)) cyl(mha2).Scale=Vector3.new(1,1,1) weld(mha,mha2,cfn(0,0,-0.3)*ang(mr(-90),0,0)) mha2b=cp(tube,"Really black",Vector3.new(0.2,0.2,0.2)) cyl(mha2b).Scale=Vector3.new(0.9,1.02,0.9) weld(mha2,mha2b,cfn(0,0,0)*ang(0,0,0)) local filtr=int("Model",ch) filtr.Name='TargetFilter' m.TargetFilter=filtr drawLine=function(point_a,point_b,bc_code) local dist=(point_a-point_b).magnitude; local rad=dist/2; local line=Instance.new('Part',filtr) line.Anchored=true; line.FormFactor='Custom'; line.Transparency=0.4 line.Color=BrickColor.new(bc_code).Color; line.CanCollide=false; line.Size=Vector3.new(sz,.1,dist); Instance.new("BlockMesh",line).Name='blok' line.CFrame=CFrame.new(point_a,point_b)*CFrame.new(0,0,-rad); return line; end; draw=false mha3=nil m.Button1Down:connect(function() if sheathed==false then for _,v in pairs(undotable) do ypcall(function() for i=1,10 do table.remove(undotable,_) end end) table.remove(undotable,_) end draw=true spray.Looped=true spray:Play() mha3=cp(tube,clr,Vector3.new(0.2,0.2,0.2),true,false) cyl(mha3).Scale=Vector3.new(1,1,1) position=m.Hit game:service'RunService'.RenderStepped:connect(function() position=m.Hit local distance = (position.p - mha2.CFrame.p).magnitude mha3.Size=Vector3.new(0.2,distance,02) mha3.CFrame=CFrame.new(position.p, mha2.CFrame.p) * CFrame.new(0, 0, -distance/2)*ang(mr(-90),0,0) end) end end) m.Button1Up:connect(function() spray:Stop() spray.Looped=false draw=false ypcall(function() mha3:Destroy() end) end) plr.Chatted:connect(function(chat) if chat:sub(1,4)=='clr;' and sheathed==false then ypcall(function() clr=string.sub(chat,5) mh.BrickColor=BrickColor.new(clr) pz.BrickColor=BrickColor.new(clr) Tween(rw,cfn()*ang(mr(-110),mr(-20),mr(-10)),0.3) Tween(rw,cfn()*ang(mr(-90),mr(-20),mr(-10)),0.3) Tween(rw,cfn()*ang(mr(-110),mr(-20),mr(-10)),0.3) Tween(rw,cfn()*ang(mr(-90),mr(-20),mr(-10)),0.3) end) elseif chat:sub(1,3)=='sz;' then sz=tonumber(string.sub(chat,4)) elseif chat:sub(1,4)=='mag;' then mag=tonumber(string.sub(chat,5)) end end) tttable={} sheathed=false m.KeyUp:connect(function(key) if key=='z' then for i=1,10 do for _,v in pairs(undotable) do v:Destroy() table.remove(undotable,_) end end elseif key=='c' then for i=1,10 do for _,v in pairs(tttable) do ypcall(function() v:Destroy() end) table.remove(tttable,_) end end elseif key=='e' and sheathed==false then clr=tostring(BrickColor.Random()) mh.BrickColor=BrickColor.new(clr) pz.BrickColor=BrickColor.new(clr) Tween(rw,cfn()*ang(mr(-110),mr(-20),mr(-10)),0.3) Tween(rw,cfn()*ang(mr(-90),mr(-20),mr(-10)),0.3) Tween(rw,cfn()*ang(mr(-110),mr(-20),mr(-10)),0.3) Tween(rw,cfn()*ang(mr(-90),mr(-20),mr(-10)),0.3) elseif key=='q' and sheathed==false then Tween(rw,cfn()*ang(0,0,0),0.2) mw:Destroy() mw=weld(torso,mh,CFrame.new(1.3,-1.6,0.16)*ang(math.rad(-30),0,0)) rabr:Destroy() w:Destroy() labr:Destroy() ww:Destroy() sheathed=true elseif key=='q' and sheathed==true then mw:Destroy() ypcall(function() mw:Destroy() end) mw=weld(ch['Right Arm'],mh,cfn(0,-1,0)*ang(mr(-90),0,0)) rabr = cp(tube,'White',Vector3.new(1,1,1),false,false) rabr.Transparency = 1 rabr.Name='Locker' rabr.Position = torso.Position rw = Weld(rabr,torso,1.5,.5,0,0,0,0) rw.Parent = tube rw.Name = 'rw' w = Instance.new("Weld",tube) w.Part0,w.Part1 = ch['Right Arm'],rabr w.C1 = CFrame.new(0,-.5,0) Tween(rw,cfn()*ang(mr(-90),mr(-20),mr(-10))) sheathed=false end end) Tween(rw,cfn()*ang(mr(-90),mr(-20),mr(-10))) last=m.Hit game:service'RunService'.RenderStepped:connect(function() if draw==false then last=m.Hit Tween(rw,cfn()*ang(mr(-70),mr(-40),0),0.02) Tween(rw,cfn()*ang(mr(-60),mr(-30),0),0.02) else ypcall(function() if m.Target and m.Target.Parent and m.Target.Parent:findFirstChild('Humanoid') then m.Target.Parent.Humanoid:TakeDamage(1) end end) coroutine.resume(coroutine.create(function() if m.Hit and m.Target then local c=m.Hit local m=(c.p-last.p).magnitude; if(m>mag)then local l=drawLine(last.p,c.p,clr); Instance.new("PointLight",l).Color=l.BrickColor.Color l.Material='Neon' table.insert(undotable,l) table.insert(tttable,l) last=c; end; end end)); end end) --hl/https://httpget-inumeration.c9.io/spraycan.lua
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement