You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
What is the issue? Include screenshots / videos if possible!
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- This is an example Lua code block
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
I’m trying to make it so when I click a button a countdown is displayed on the screen.
I tried doing this by using making it so when I click the button it uses a remote event to trigger something that will cause a IntValue to go down and while this IntValue goes down, the timer text label will update itself. if IntValue changes.
I’m new to scripting and I’m not sure what’s wrong with this.
timer LocalScript (sorry, my mouse isn’t working well so I will post the other scripts
local intValue = game.ReplicatedStorage.time
local function updateTextLabel()
textLabel.Text = tostring(intValue.Value)
end
intValue.Changed:Connect(updateTextLabel)
Server Script
local remoteEvent = game.ReplicatedStorage.remoteEvents.timerRE
local timerValue = game.ReplicatedStorage.time.Value
remoteEvent.OnServerEvent:Connect(function(player, timer)
for i = timer, -1, 0 do
timerValue = i
task.wait(1)
end
end)
This is a problem many new scripters face with values! When editing a value instance you actually have to say timerValue.Value = i.
Heres the updated code:
local remoteEvent = game.ReplicatedStorage.remoteEvents.timerRE
local timerValue = game.ReplicatedStorage.time
remoteEvent.OnServerEvent:Connect(function(player, timer)
for i = timer, -1, 0 do
timerValue.Value = i
task.wait(1)
end
end)
I just moved the .Value from the second line to the timerValue = i line.