Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Client Side
- local plr = game.Players.LocalPlayer
- local mouse = plr:GetMouse()
- local tool = script.Parent
- script.Parent.Activated:Connect(function()
- tool.Event1:FireServer(mouse)
- end)
- --Server Side
- local tool = script.Parent
- d = false
- local shoot = tool.Handle.GunShot
- local ting = tool.Handle.BulletTing
- local reload = tool.Handle.GunReload
- tool.Event1.OnServerEvent:Connect(function(plr,mouse)
- shoot:Play()
- local b = Instance.new("Part",workspace)
- local v = Instance.new("BodyVelocity",b)
- b.Size = Vector3.new(.1,.1,.5)
- b.BrickColor = BrickColor.new("Bright yellow")
- b.Material = "Neon"
- local ray = Ray.new(tool.Handle.CFrame.p,(mouse.Hit.p - tool.Handle.CFrame.p).unit)
- local part,position = workspace:FindPartOnRay(ray, plr.Character,true,true)
- b.CFrame = CFrame.new(tool.Handle.CFrame.p,position)
- v.Velocity = (b.CFrame.LookVector) * 500
- game.Debris:AddItem(b,5)
- part.Touched:Connect(function(p)
- if not d and p.Parent.Name ~= plr.Name and p.CanCollide == true then
- d = true
- if p.Parent:FindFirstChild("Humanoid") then
- p.Parent.Humanoid:TakeDamage(10)
- end
- b:Destroy()
- wait()
- d = false
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement