I want to try making the gun script, automatic (rapid). But the problem is I don't know how to trigger it properly. Look down for examples.
Here's an brief-example of what I did so far:
mouse.Button1Down:connect(function() mouse.Button1Up:connect(function() game.ReplicatedStorage.ROBLOX_PistolFireEvent:FireServer(mouse.Hit.p) end)
Then here's my next one, it works fine but it shoots not automatic but pistol type. Where you have to spam click.
mouse.Button1Down:connect(function() game.ReplicatedStorage.ROBLOX_PistolFireEvent:FireServer(mouse.Hit.p) end)
Final one suggested by a user for help, it didnt work:
local shooting = false mouse.Button1Down:connect(function() shooting = true end) mouse.Button1Up:connect(function() shooting = false end) while shooting do if shooting == true then game.ReplicatedStorage.ROBLOX_PistolFireEvent:FireServer(mouse.Hit.p) wait(.2) -- time in between shots end end
For the final suggestion, I didnt get what he told me to do: - Just add a debouncer that shows if the mouse is down or not then add a loop that says if the thing is shooting then shoot -
I had to use UristMcSpark pistol because I'm not familar with gun-scripting, rather than GUI scripting.