DrakerMaker

garf gun

Sep 2nd, 2019
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.75 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,Mouse,mouse,UserInputService,ContextActionService = owner
  3. do
  4. script.Parent = Player.Character
  5.  
  6. --RemoteEvent for communicating
  7. local Event = Instance.new("RemoteEvent")
  8. Event.Name = "UserInput_Event"
  9.  
  10. --Fake event to make stuff like Mouse.KeyDown work
  11. local function fakeEvent()
  12. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  13. t.connect = t.Connect
  14. return t
  15. end
  16.  
  17. --Creating fake input objects with fake variables
  18. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  19. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  20. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  21. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  22. end}
  23. --Merged 2 functions into one by checking amount of arguments
  24. CAS.UnbindAction = CAS.BindAction
  25.  
  26. --This function will trigger the events that have been :Connect()'ed
  27. local function te(self,ev,...)
  28. local t = m[ev]
  29. if t and t._fakeEvent and t.Function then
  30. t.Function(...)
  31. end
  32. end
  33. m.TrigEvent = te
  34. UIS.TrigEvent = te
  35.  
  36. Event.OnServerEvent:Connect(function(plr,io)
  37. if plr~=Player then return end
  38. if io.isMouse then
  39. m.Target = io.Target
  40. m.Hit = io.Hit
  41. else
  42. local b = io.UserInputState == Enum.UserInputState.Begin
  43. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  44. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  45. end
  46. for _,t in pairs(CAS.Actions) do
  47. for _,k in pairs(t.Keys) do
  48. if k==io.KeyCode then
  49. t.Function(t.Name,io.UserInputState,io)
  50. end
  51. end
  52. end
  53. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  54. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  55. end
  56. end)
  57. Event.Parent = NLS([==[
  58. local Player = game:GetService("Players").LocalPlayer
  59. local Event = script:WaitForChild("UserInput_Event")
  60.  
  61. local UIS = game:GetService("UserInputService")
  62. local input = function(io,a)
  63. if a then return end
  64. --Since InputObject is a client-side instance, we create and pass table instead
  65. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  66. end
  67. UIS.InputBegan:Connect(input)
  68. UIS.InputEnded:Connect(input)
  69.  
  70. local Mouse = Player:GetMouse()
  71. local h,t
  72. --Give the server mouse data 30 times every second, but only if the values changed
  73. --If player is not moving their mouse, client won't fire events
  74. while wait(1/30) do
  75. if h~=Mouse.Hit or t~=Mouse.Target then
  76. h,t=Mouse.Hit,Mouse.Target
  77. Event:FireServer({isMouse=true,Target=t,Hit=h})
  78. end
  79. end]==],Player.Character)
  80. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  81. end
  82. print([[
  83. lmao why did i choose to
  84. create an
  85. garf gun
  86. ]])
  87. Plr = owner
  88. Char = Plr.Character
  89. Create = Instance.new
  90. local txt = Instance.new("BillboardGui", Char)
  91. txt.Adornee = Char .Head
  92. txt.Name = "_status"
  93. txt.Size = UDim2.new(2, 0, 0.2, 0)
  94. txt.StudsOffset = Vector3.new(-9, 3, 0)
  95. local text = Instance.new("TextLabel", txt)
  96. text.Size = UDim2.new(10, 0, 7, 0)
  97. text.FontSize = "Size24"
  98. text.TextScaled = true
  99. text.TextTransparency = 0
  100. text.BackgroundTransparency = 1
  101. text.TextTransparency = 0
  102. text.TextStrokeTransparency = 0
  103. text.Font = "Highway"
  104. text.TextStrokeColor3 = BrickColor.new("Dark orange").Color
  105. text.TextColor3 = BrickColor.new("Deep orange").Color
  106. text.Text = owner.Name:lower().." has an garfield gun"
  107. local Sound = Instance.new("Sound", workspace)
  108. Sound.SoundId = "rbxassetid://174890238"
  109. Sound.Volume = 2
  110. Sound:Play()
  111. function wbtwe(Part0, Part1, C0)
  112. local weld = Instance.new("Weld", Part0)
  113. weld.Part0 = Part0
  114. weld.Part1 = Part1
  115. weld.C0 = Part1.CFrame:inverse() *Part1.CFrame *C0
  116. return weld
  117. end
  118. idle = 3.7
  119. walk = 1
  120. tilt = 1
  121. animateing = false
  122. deb = false
  123. hrw = wbtwe(owner.Character.Torso, owner.Character.HumanoidRootPart, CFrame.new(0, 0, 0))
  124. law = wbtwe(owner.Character["Left Arm"], owner.Character.Torso, CFrame.new(1.45, 0.1, 0.1) *CFrame.Angles(0, 25, 0.3))
  125. raw = wbtwe(owner.Character["Right Arm"], owner.Character.Torso, CFrame.new(-1.4, 0.1, 0) *CFrame.Angles(0, 0, -0.3))
  126. llw = wbtwe(owner.Character["Left Leg"], owner.Character.Torso, CFrame.new(0.45, 2.1, 0) *CFrame.Angles(0, 25, 0))
  127. rlw = wbtwe(owner.Character["Right Leg"], owner.Character.Torso, CFrame.new(-0.4, 2.1, 0) *CFrame.Angles(0, 0, 0))
  128. hw = wbtwe(owner.Character.Head, owner.Character.Torso, CFrame.new(0, -1.45, 0) *CFrame.Angles(0, 0, 0))
  129. Char.Humanoid.WalkSpeed = 45
  130. Char.Humanoid.JumpPower = 67
  131. local sound = Instance.new("Sound", owner.Character.Head)
  132. sound.SoundId = "rbxassetid://2586147657"
  133. sound.Volume = 2
  134. sound.PlaybackSpeed = 1.2
  135. local Distortion = Instance.new("FlangeSoundEffect")
  136. Distortion.Rate = 8
  137. Distortion.Parent = sound
  138. sound:Play()
  139. arms = 1
  140. gun = Create("Part", owner.Character)
  141. gun.Size = Vector3.new(0.64, 1.15, 3.55)
  142. gun.CanCollide = false
  143. gunw = wbtwe(gun, owner.Character["Right Arm"], CFrame.new(0, 1.3, 0))
  144. specialmesh = Create("SpecialMesh", gun)
  145. specialmesh.MeshId = "http://www.roblox.com/asset/?id=94690054"
  146. specialmesh.TextureId = "http://www.roblox.com/asset/?id=94689966"
  147. specialmesh.Scale = Vector3.new(1, 1, 1)
  148. boom = Create("Sound", gun)
  149. boom.SoundId = "rbxassetid://573314737"
  150. boom.Volume = 3
  151. head = coroutine.wrap(function()
  152. while game:GetService("RunService").Stepped:wait() do
  153. for i = 0,1,0.1 do
  154. game:GetService("RunService").Stepped:wait()
  155. hw.C0 = hw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0, -1.45, 0.5) *CFrame.Angles(-0.5, 0, 0), 0.5)
  156. end
  157. for i = 0,1,0.1 do
  158. game:GetService("RunService").Stepped:wait()
  159. hw.C0 = hw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0, -1.45, -0.5) *CFrame.Angles(0.5, 0, 0), 0.5)
  160. end
  161. end
  162. end)head()
  163. health = coroutine.wrap(function()
  164. while game:GetService("RunService").Stepped:wait() do
  165. Char.Humanoid.MaxHealth = math.huge
  166. Char.Humanoid.Health = math.huge
  167. end
  168. end)health()
  169. anim = coroutine.wrap(function()
  170. while game:GetService("RunService").Stepped:wait() do
  171. if Char.HumanoidRootPart.Velocity.Magnitude < 1 then
  172. arms = arms +0.6
  173. for i = 0,1,0.1 do
  174. game:GetService("RunService").Stepped:wait()
  175. arms = arms +0.3
  176. law.C0 = law.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(1.45, 0.1, 0.1) *CFrame.Angles(0, 25, math.sin(arms) *1), 0.1)
  177. raw.C0 = raw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-1.4, 0.1, 0.1) *CFrame.Angles(0, 0, math.sin(-arms) *1), 0.1)
  178. llw.C0 = llw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0.45, 2.1, 0) *CFrame.Angles(0, 25, 0), 0.1)
  179. rlw.C0 = rlw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-0.4, 2.1, 0) *CFrame.Angles(0, 0, 0), 0.1)
  180. end
  181. end
  182. if Char.HumanoidRootPart.Velocity.Magnitude > 1 then
  183. for i = 0,1,0.1 do
  184. game:GetService("RunService").Stepped:wait()
  185. law.C0 = law.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(1.45, 0, -1) *CFrame.Angles(1.7, 25, 0), 0.1)
  186. raw.C0 = raw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-1.4, 0, 1) *CFrame.Angles(-1.7, 0, 0), 0.1)
  187. llw.C0 = llw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0.45, 2.1, -0.4) *CFrame.Angles(1.7, 25, 0), 0.1)
  188. rlw.C0 = rlw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-0.4, 2.1, 0.4) *CFrame.Angles(-1.7, 0, 0), 0.1)
  189. end
  190. for i = 0,1,0.1 do
  191. game:GetService("RunService").Stepped:wait()
  192. law.C0 = law.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(1.45, 0, 1) *CFrame.Angles(-1.7, 25, 0), 0.1)
  193. raw.C0 = raw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-1.4, 0, -1) *CFrame.Angles(1.7, 0, 0), 0.1)
  194. llw.C0 = llw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0.45, 2.1, 0.4) *CFrame.Angles(-1.7, 25, 0), 0.1)
  195. rlw.C0 = rlw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-0.4, 2.1, -0.4) *CFrame.Angles(1.7, 0, 0), 0.1)
  196. end
  197. end
  198. end
  199. end)anim()
  200. mouse.Button1Down:connect(function()
  201. boom:Play()
  202. text.Text = "bom"
  203. wait(0.2)
  204. text.Text = owner.Name:lower().." has an garfield gun"
  205. local garf = Instance.new("Part", workspace)
  206. garf.Anchored = true
  207. garf.Position = mouse.Hit.p
  208. garf.CanCollide = false
  209. local explode = Instance.new("Part", workspace)
  210. explode.Anchored = true
  211. explode.Position = garf.Position
  212. explode.Shape = "Ball"
  213. explode.Size = Vector3.new(5, 5, 5)
  214. explode.BrickColor = BrickColor.new("Bright orange")
  215. explode.Material = "Neon"
  216. explode.Transparency = 0.4
  217. explode.CanCollide = false
  218.  
  219. specialmesh = Create("SpecialMesh", garf)
  220. specialmesh.MeshId = "rbxassetid://710763311"
  221. specialmesh.TextureId = "rbxassetid://710763383"
  222. specialmesh.Scale = Vector3.new(15, 15, 15)
  223. local ray = Ray.new(gun.CFrame.p, (mouse.Hit.p - gun.CFrame.p).unit*300)
  224. local hit, position = workspace:FindPartOnRay(ray, owner.Character)
  225.  
  226. --do damage to any humanoids hit
  227. local humanoid = hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid")
  228. if humanoid then
  229. humanoid:TakeDamage(30)
  230. end
  231.  
  232. --draw the ray
  233. local distance = (position - gun.CFrame.p).magnitude
  234. local rayPart = Instance.new("Part", owner.Character)
  235. rayPart.Name = "RayPart"
  236. rayPart.BrickColor = BrickColor.new("Bright orange")
  237. rayPart.Material = "Neon"
  238. rayPart.Transparency = 0.4
  239. rayPart.Anchored = true
  240. rayPart.CanCollide = false
  241. rayPart.TopSurface = Enum.SurfaceType.Smooth
  242. rayPart.BottomSurface = Enum.SurfaceType.Smooth
  243. rayPart.formFactor = Enum.FormFactor.Custom
  244. rayPart.Size = Vector3.new(2, 2, distance)
  245. rayPart.CFrame = CFrame.new(position, gun.CFrame.p) * CFrame.new(0, 0, -distance/2)
  246.  
  247. --add it to debris so it disappears after 0.1 seconds
  248. game.Debris:AddItem(rayPart, 0.1)
  249. garf.Touched:connect(function(p)
  250. if p.Parent:FindFirstChildOfClass("Humanoid") then
  251. p.Parent:FindFirstChildOfClass("Humanoid"):TakeDamage(5)
  252. end
  253. end)
  254. for i = 1,105 do
  255. game:GetService("RunService").Stepped:wait()
  256. garf.Transparency = garf.Transparency +0.01
  257. garf.Size = garf.Size +Vector3.new(1, 1, 1)
  258. explode.Size = explode.Size +Vector3.new(1, 1, 1)
  259. explode.Transparency = explode.Transparency +0.01
  260. specialmesh.Scale = specialmesh.Scale +Vector3.new(1, 1, 1)
  261. end
  262. garf:Destroy()
  263. explode:Destroy()
  264. end)
Add Comment
Please, Sign In to add comment