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

How to make a script that when you click something, It gives you a tool with a cooldown?

Asked by 4 years ago

No message by the way. I know I'm very demanding, but I really need it so that it has something to do with the ServerStorage. Also, I'm bad at scripting so I don't know here to start.

0
use debounce,check if debounce is false, if its false then parent the tool then set debounce as true and wait, then set debounce as false maumaumaumaumaumua 628 — 4y

1 answer

Log in to vote
0
Answered by
profak 15
4 years ago

You'd need a part, a click detector, the tool and a server script

plae the tool in serverstorage the click detector inside the part the script inside the part and this inside the script


local tool = game.ServerStorage.Tool -- In this case I'm going to assume you're clicking a part -- This script would go inside of the part -- The tool can go anywhere, best to go in serverstorage in my op local part = script.Parent -- Assuming the part that you need to be clicked is the parent of this script local debounce = false -- The variable used to check if a tool has been taken part.ClickDetector.MouseClick:Connect(function(clicker) if debounce == false then debounce = true coroutine.resume(coroutine.create(function() wait(3) debounce = false end)) -- 3 Seconds then you can get the tool again local tool2 = tool:Clone() tool2.Parent = clicker.Backpack end end)

This is on the server, so only 1 person can take the tool every 3 seconds Player 1 : ** takes tool** Player 2 : "Owo" cant take tool for 3 more seconds

0
Thank you OneUselessBaconHair -3 — 4y
Ad

Answer this question