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

Can someone help me with stopping vehicle spammers?

Asked by 3 years ago
Edited 3 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).

Ive made this code below and it duplicates the car from server storage and spawns it in a certain place, my problem is if someone is to spawn a different car the old one will still be there and the spawn button can be pressed multiple times and the cars will spawn on each other is there a way I could alter this script?

script.Parent.MouseButton1Click:connect(function(GetCar)
        Mod = game.ServerStorage.BMW330DCIV
        clone = Mod:clone()
        clone.Parent = workspace
    clone:MakeJoints()

end)

I also have a local script in the button too which teleports the player to the car and deactivates the Gui which is here

local Button = script.Parent
    Button.MouseButton1Click:Connect(function()
        local player = game.Players.LocalPlayer
        player.Character.HumanoidRootPart.CFrame = CFrame.new(-19.3, 1.05, 57.68)
    script.Parent.Parent.Parent.Enabled = false
end)

thanks

0
You can make a debounce. Dovydas1118 1495 — 3y
0
sorry but that doesn't really help Joey111961 -20 — 3y
0
A debounce always helps, especially for this situation. Also edit your code to include the code block. Dovydas1118 1495 — 3y
0
@Dovydas1118 Your idea is good. Debounces are really helpful in situations like these. Soban06 410 — 3y
0
Im relatively new to scripting so could you help me with making a script that does that or giving me information on how id go about it thanks Joey111961 -20 — 3y

Answer this question