I want to have a chest that, when clicked, gives the player an item. Then, the Chest will cooldown for 45 seconds until it can be used again. All the code for this part works.
My problem is in the sign displayed above the chest. It says "CLICK FOR TREASURE!", but once the chest is clicked, it will change to "COOLING DOWN...". This part doesn't work.
Code:
local tool = script.Parent.Item.Value
local signText = script.Parent.PizzaSwordSign.SurfaceGui.TextLabel.Text
local takable = true
local Sound = game.Workspace.Map.Maze.PizzaSwordGiver.Script.Sound
local function give(playerWhoClicked)
if takable then
local sword = game.ServerStorage["PizzaSword"]:Clone()
sword.Parent = playerWhoClicked.Backpack
sword:Clone().Parent = playerWhoClicked.StarterGear
Sound:Play()
takable = false
signText = "COOLING DOWN..."
wait (45)
takable = true
signText = "CLICK FOR TREASURE!"
end
end
script.Parent.ClickDetector.MouseClick:Connect(give)
Thanks in advance, Mex
