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
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