Local script not changing text label value

Hi, i am trying to make a working scoreboard gui that updates whenever a team scores a goal, but it isn’t working. Here is the script. (i apologise if what i said isn’t clear)

game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui')

local Players = game:GetService("Players")

local client = Players.LocalPlayer

local playersService = game:GetService("Players")

local scoreBoardGui = game.StarterGui.ScoreGui

local elfScore = scoreBoardGui.Score.SpursScore

local gnomeScore = scoreBoardGui.Score.ArsenalScore

local status = scoreBoardGui.Status

local timer = scoreBoardGui.Timer

local minutes = 0

local minuteLength = 1

local RS = game.ReplicatedStorage

local RF = game.ReplicatedFirst

local SS = game.ServerStorage

local goal1 = workspace.goal1

local goal2 = workspace.goal2

local goal2 = workspace.goal2

local ball = workspace.TPS

local function score(team)
	team.Text = team.Text + 1
	status.Text = "GOAL"
	wait (5)
end

ball.Touched:Connect(function(part)
	if part == goal1 then
		score(gnomeScore)

	elseif part == goal2 then
		score(elfScore)

	end

end)
for minutes=1, 400 do
	timer.Text = "Timer: " .. minutes
	status.Text = ""

	if minutes == 200 then
		status.Text = "Half Time"
	end
end

if minutes == 400 then
	status.Text = "Full Time"
end
1 Like

On the text label, add a local script that does

status.Changed:Connect(function()
script.Parent.Text = status.Value
end)
1 Like

should i add this to all four text labels? image

Yep. Make sure to make the status variable.

I don’t understand this part :slight_smile:. How can you add 1 to a string? I’m new so I don’t understand anything, yet :).

> local status = game.StarterGui.ScoreGui.Status
> 
> status.Changed:Connect(function()
> 
> script.Parent.Text = status.Value
> 
> end)

So like this?

i had a surface gui and i was modifying everything from a server script

Correct. Make sure it’s a localscript.

now i changed to a local script in starter player scripts

nothing works at all but there isnt any errors

if you wanna see my server sided script, take the model and review it GameScript - Roblox

You need to put the script inside the GUI or change the “script.Parent” to the directory of the GUI

i put the script inside all the text labels

update: i got an error “value isnt a valid member of textlabel”

Change status.Value to status.Text

thats what i did and it still didnt work

Are you sure? Does it still give “value isnt a valid member of textlabel”

no it doesnt give any errors, it just doesnt work

image
as u see, this script works fine on a surface gui (this time this script is in server script service)

local scoreBoardGui = workspace.Score.ScoreboardGui

local elfScore = scoreBoardGui.Score.SpursScore

local gnomeScore = scoreBoardGui.Score.ArsenalScore

local status = scoreBoardGui.Status

local timer = scoreBoardGui.Timer

local goal1 = workspace.goal1

local goal2 = workspace.goal2

local ball = workspace.TPS

local originalPosition = ball.Position

local minutes = 0

local minuteLength = 1

local function score(team)
	team.Text = team.Text + 1

	status.Text = "GOAL"
	wait (5)

	for index, player in next, playersService:GetPlayers() do
		player:LoadCharacter()

	end
	resetBall(0.0001)
end

ball.Touched:Connect(function(part)
	if part == goal1 then
		score(gnomeScore)

	elseif part == goal2 then
		score(elfScore)

	end

end)

for minutes=1, 400 do
	timer.Text = "Timer: " .. minutes
	status.Text = ""

	if minutes == 200 then
		status.Text = "Half Time"
		resetBall(15)
		for index, player in next, playersService:GetPlayers() do
			player:LoadCharacter()
		end
	end
	if minutes == 400 then
		status.Text = "Full Time"
		resetBall(15)
		for index, player in next, playersService:GetPlayers() do
			player:LoadCharacter()
		end
	end
	wait(minuteLength)
end

and im not getting any errors if u were wondering