I have a script it is supposed to refresh your character. I would like for it to be such as : "once u click the button it refreshes your character then it says a countdown from 2 minutes then after 2 mins is up you can use it again." heres the script so far:
plr = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() pcall(function() local Pos = plr.Character:GetPrimaryPartCFrame() plr:LoadCharacter() plr.Character:SetPrimaryPartCFrame(Pos) if plr.Character:FindFirstChild("ForceField") then plr.Character["ForceField"]:Destroy() end end) end)
I don't know if this is possible I tried so many things such as adding more functions but couldn't get it to work.
You will want to use a debounce for this. Using a debounce allows you to make something not run until you want it too
plr = game.Players.LocalPlayer local debounce = false script.Parent.MouseButton1Click:connect(function() pcall(function() if debounce == false then debounce = true --set it to true so the condition wont pass local Pos = plr.Character:GetPrimaryPartCFrame() plr:LoadCharacter() plr.Character:SetPrimaryPartCFrame(Pos) if plr.Character:FindFirstChild("ForceField") then plr.Character["ForceField"]:Destroy() end wait(60 * 2) --waits two minutes debounce = false --allows the function to run again end end) end)