Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local plr = game.Players.LocalPlayer
- local mouse = plr:GetMouse()
- local uis = game:GetService("UserInputService")
- local onBulletShot = script.Parent:WaitForChild("OnBulletShot")
- local onReload = script.Parent:WaitForChild("OnReload")
- local onCursorChange = script.Parent:WaitForChild("OnCursorChange")
- local isDown = false
- local timePerBullet = 0.2
- local isCooldown = false
- uis.InputBegan:Connect(function(input, processed)
- if script.Parent.Parent == plr.Character then
- if input.KeyCode ~= Enum.KeyCode.R or processed then return end
- onReload:FireServer()
- end
- end)
- onCursorChange.OnClientEvent:Connect(function(mouseIcon)
- mouse.Icon = mouseIcon
- end)
- mouse.Button1Down:Connect(function()
- isDown = true
- end)
- mouse.Button1Up:Connect(function()
- isDown = false
- end)
- while wait() do
- if script.Parent.Parent == plr.Character and not isCooldown then
- if isDown then
- isCooldown = true
- onBulletShot:FireServer(mouse.Hit, mouse.Target)
- wait(timePerBullet)
- isCooldown = false
- end
- end
- end
Add Comment
Please, Sign In to add comment