Text Changer (:Changed) doesn't work

Hey guys how are you? I hope you do very very well ! This time I’m making a round system with a timer, but when I try to change the Gui Text when the IntValue changes, it doesn’t.

Here’s the script:

  • Everything is on a LocalScript
for i, v in pairs(game.Players:GetPlayers()) do
			v:WaitForChild('PlayerGui').LeaderTimer.SecondsLeft.Visible = true
			v:WaitForChild('PlayerGui').LeaderTimer.ChooseYourLeaderText.Visible = true
		end
		for i= 1, 45, 1 do
			wait(1)
			game.ReplicatedStorage.LeaderTimer2.Value = game.ReplicatedStorage.LeaderTimer2.Value - 1
		end
		for i, v in pairs(game.Players:GetPlayers()) do
			v:WaitForChild('PlayerGui').LeaderTimer.SecondsLeft.Visible = false
			v:WaitForChild('PlayerGui').LeaderTimer.ChooseYourLeaderText.Visible = false
			if v.PlayerGui.LeaderTimer.SecondsLeft.Visible == false then
				v.PlayerGui.LeaderTimer.SecondsLeft.Visible = not v.PlayerGui.LeaderTimer.SecondsLeft.Visible
			end
			if v.PlayerGui.LeaderTimer.ChooseYourLeaderText.Visible == false then
				v.PlayerGui.LeaderTimer.ChooseYourLeaderText.Visible = not v.PlayerGui.LeaderTimer.ChooseYourLeaderText.Visible
			end
		end

And on the script that is on the Gui it is like this:

game.ReplicatedStorage.LeaderTimer2.Changed:Connect(function()
	script.Parent.Text = game.ReplicatedStorage.LeaderTimer2.Value
end)

It shows me this number:
image

It should show me this number:
image

I know there’s a lot of good people here in the devforum, so I’ll appreciate you and your help If you can give me a hand with this! :wave: :grinning_face_with_smiling_eyes: :wink:

textbox.FocusLost is better since it detects it properly

So Script.Parent.FocusLost? because the value that changes is an IntValue

Fire a RemoteEvent to change the value.
You are trying to change the value in ReplicatedStorage on Client-sided which it won’t replicate to Server.
Which also explains why the TextLabel won’t change as its focusing on Server.

1 Like

Oh, I thought you meant textboxes, well no idea.

--SERVER SCRIPT--
local storage = game:GetService("ReplicatedStorage")
local leaderTimer = storage:WaitForChild("LeaderTimer2")

for i = 45, 0, -1 do
	task.wait(1)
	leaderTimer.Value -= 1
end

Place inside ServerScriptService.

--LOCAL SCRIPT--
local players = game:GetService("Players")
local player = players.LocalPlayer or players.PlayerAdded:Wait()
local playerGui = player:WaitForChild("PlayerGui")
local leaderTime = playerGui:WaitForChild("LeaderTimer")
local storage = game:GetService("ReplicatedStorage")
local leaderTimer2 = storage:WaitForChild("LeaderTimer2")

leaderTimer2.Changed:Connect(function(newVal)
	script.Parent.Text = leaderTimer.Value
	leaderTime:WaitForChild("SecondsLeft").Visible = true
	leaderTime:WaitForChild("ChooseYourLeaderText").Visible = true
	if newVal <= 0 then
		task.wait(3)
		leaderTime:WaitForChild("SecondsLeft").Visible = false
		leaderTime:WaitForChild("ChooseYourLeaderText").Visible = false
	end
end)

Place inside StarterPlayerScripts or StarterCharacterScripts.