I edited a script and I made it where the item giver has a cooldown heres the script:
local PassId = 4835177 local ReplicatedStorage = game:GetService("ReplicatedStorage") local MarketplaceService = game:GetService("MarketplaceService") local BloxyCola = ReplicatedStorage:WaitForChild("????? ???? ???") local player = game.Players.LocalPlayer local bloxy = workspace:WaitForChild("itemgiver1") bloxy.ClickDetector.MouseClick:Connect(function(player) BloxyCola:Clone().Parent = player.Backpack script.Parent.Transparency=1 script.Parent.ClickDetector:Destroy() for i = 10, 1, -1 do -- give it a 60 second cooldown and show the timer script.Parent.BillboardGui.TextBox.Text = tostring(i) wait(1) end script.Parent.BillboardGui.TextBox.Text=(" ") --replaces text and resets everything back to normal script.Parent.Transparency=0 local ClickDetector = Instance.new("ClickDetector") ClickDetector.Parent = bloxy ClickDetector.MaxActivationDistance = 10 end)
but when the item spawns back i can't click it again, even though it shows the click cursor. what am i doing wrong here?
There is no reason to remove the clickdetector, you could instead use debounce. Debounce allows you to essentially deny all incoming requests from a connection until it is returned to false
local PassId = 4835177 local ReplicatedStorage = game:GetService("ReplicatedStorage") local MarketplaceService = game:GetService("MarketplaceService") local BloxyCola = ReplicatedStorage:WaitForChild("????? ???? ???") local player = game.Players.LocalPlayer local bloxy = workspace:WaitForChild("itemgiver1") local debounce = false bloxy.ClickDetector.MouseClick:Connect(function(player) if not debounce then debounce = true -- stops any more clicks going through because of the line above this one BloxyCola:Clone().Parent = player.Backpack script.Parent.Transparency=1 for i = 10, 1, -1 do -- give it a 60 second cooldown and show the timer script.Parent.BillboardGui.TextBox.Text = tostring(i) wait(1) end script.Parent.BillboardGui.TextBox.Text=(" ") --replaces text and resets everything back to normal script.Parent.Transparency = 0 debounce = false -- allow the script to be run again end end)