Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I have been trying to make a cooldown but it doesn't work. Can anyone help me?

So I made a cool down system. It runs when "k" is pressed, it works but the GUI dose not change. I looked at the properties of the GUI, the text property changed but not on screen. I added a print statement and it ran. The script is a LocalScript held in StarterCharacterScripts.

    local m = game.Players.LocalPlayer:GetMouse()

db = true

block = true -- This is for blocking the action so you cant use it while it is cooling down.

timer = 1 -- This is the timer for the cooldown. It repeats.

m.KeyDown:connect(function(k)

k = k:lower()

if k == "k" then

if db == true then

if block == true then

print("test")

block = false

wait(timer)

game.StarterGui.Test.Frame.TextBox.Text = "test"

block = true

end

end

end

end)

2 comments

0

Well your cool down is 1 second. So legit you wouldn't be able to tell much difference unless you have a very fast computer

0

You’re using StarterGui, which only replicates/shows changes to everyone when they respawn/join. What you’d want to use is PlayerGui. You can access it by doing game.Players.LocalPlayer.PlayerGui.

1 answer

I needed to use game.Players.LocalPlayer.PlayerGui.Test.Frame.TextBox.Text = "4" Instead of game.StarterGui.Test.Frame.TextBox.Text = "4"

This discussion is preserved as it was. New answers, comments, and votes are closed.