Hi. I have managed to msg player when player clicks to get item if player already have that item in inventory but i have no idea how to add a cooldown on it instead of checking backpack.
Hope someone can help me change from this to cooldown timer for player (I would wish to have option to do it for all players and option for only player that have clicked. If not possible then only for player who clicked)
NOTE: I'm a compleete noob in scripting
function onClicked() do
--for i=1, 1 do
--while wait(5) do
for _, player in ipairs(game.Players:GetPlayers()) do
if player:FindFirstChild("Backpack") then
if player:FindFirstChild("Backpack"):FindFirstChild("Blue Master Key")
or
player:FindFirstChild("Backpack"):FindFirstChild("Green Master Key")
or
player:FindFirstChild("Backpack"):FindFirstChild("Red Master Key")
or
player:FindFirstChild("Backpack"):FindFirstChild("Yellow Master Key")
then
local M = Instance.new("Hint")
M.Parent = game.Workspace -- Don't edit or change this.
M.Text = "You allredy own a Master Key"
wait(3) -- Wait to change insert thing.
M.Text = "You can only have 1 Master Key in your inventory"
wait(3) -- Waits to change then Remove insert differ thing.
M:Remove()
else do
------HERE GOES VERRY HUGE SCRIPT
end
end
end
end
end
end
end
end
end
end
--------------------------------------------------------------------
script.Parent.ClickDetector.MouseClick:Connect(onClicked)

4 comments
Cheers m8! This helps a little bit so they can not spam the button. But how do i add a msg that tells them how long they have to wait untill they can click again?
You need to edit the script a little to do this, but you have to create a new variable and use a loop to make it lower the value
i just want to block player from clicking again and again and getting an item. But i want the player to get msg about when he/she can get the item again- So countdown of the cooldown. I realy hope that u can help me m8
I`ll edit the script and make it show the countdown