Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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)
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 voidofdeathfire 148 — 5y
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. User#20279 0 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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

Ad

Answer this question