Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to fix this gun script? (ASAP help please!)

Asked by 8 years ago

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_MP5FireEvent: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_MP5FireEvent:FireServer(mouse.Hit.p)
    end)

1 answer

Log in to vote
0
Answered by 8 years ago
mouse.Button1Down:connect(function()
repeat
game.ReplicatedStorage.ROBLOX_MP5FireEvent:FireServer(mouse.Hit.p)
wait()
until ammo = 0 --Set your requirements to shoot here, using ammo as an example
end)

0
when I paste the code. It showed end) as error with a red-mark. ShinoKae 0 — 8y
0
Sorry, I forgot to add an end. Just add an end without a parentheses one line before the end) Verbero 0 — 8y
0
Explain. Also, chances are this will lag the server a plenty with more than 3 players firing at once. Marios2 360 — 8y
0
Can't, wont work. I switched to UristMcSpark pistol btw. Now it's game.ReplicatedStorage.ROBLOXPistolFireEvent:FireServer(mouse.Hit.p) ShinoKae 0 — 8y
Ad

Answer this question