I’m trying to make a scoring system for my soccer like game and the Score UI won’t update. I’ve tried using RemoteEvent and several other ways but non of it worked. Can anyone please help me?
ServerScriptService Script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Sphere = workspace.Sphere
local BlueScore = ReplicatedStorage.BlueScore
local RedScore = ReplicatedStorage.RedScore
Sphere.Touched:Connect(function(Touched)
if Touched.Name == "BlueGoal" then
RedScore.Value = RedScore.Value + 1
Sphere.Position = Vector3.new(0,10,0)
end
if Touched.Name == "RedGoal" then
BlueScore.Value = BlueScore.Value + 1
Sphere.Position = Vector3.new(0,10,0)
end
end)
Local Script that I put in the GUI:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local ScoreGUI = Players.LocalPlayer:WaitForChild("PlayerGUI"):WaitForChild("ScoreGUI")
local RedScore = ReplicatedStorage.RedScore
local BlueScore = ReplicatedStorage.BlueScore
RedScore.Changed:Connect(function()
print("CHANGED")
ScoreGUI.Red.Text = RedScore
end)
BlueScore.Changed:Connect(function()
print("CHANGED")
ScoreGUI.Blue.Text = BlueScore
end)