My script is supposed to update a text label via a string value, but it doesn't work, why?
This is the main script in my game:
local status = game.ReplicatedStorage:WaitForChild("Status") status.Value = "2 players are needed to start a game" print("Not enough players") repeat wait() until game.Players.NumPlayers >= 2
(This is in a while loop) It changes the status/string value as well but not the text label.
This is the local script inside of the text label:
local status = game.ReplicatedStorage:WaitForChild("Status") status.Changed:Connect(function() script.Parent.Text = status.Value end)
i think you forgot to change the status in the main script therefore text is not changing as well?
local status = game:GetService("ReplicatedStorage"):WaitForChild("Status") status.Value = "2 players are needed to start the game" print("Not enough players") players = game.Players:GetPlayers() local playercount = #players -- amount of players repeat wait() until playercount >= 2 local text = playercount.."players are in game." -- you can change this to whatever you want status.Value = text game.Players.PlayerAdded:Connect(function() status.Value = text end) game.Players.PlayerRemoving:Connect(function() status.Value = text end)
I figured it out myself! I found this in a forgotten old sword fighting game I made, this is a local script inside the text label:
local Status = game:GetService("ReplicatedStorage"):WaitForChild("Status") script.Parent.Text = Status.Value Status:GetPropertyChangedSignal("Value"):Connect(function() script.Parent.Text = Status.Value end)