oh this is a local script, it only appears for one player, i want it to appear for all players
Script
inside ServerScriptService
:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local val = Instance.new("IntValue", ReplicatedStorage)
val.Name = "ajax"
local val1 = Instance.new("IntValue", ReplicatedStorage)
val1.Name = "inter"
local goal1 = workspace["Away Goal"].WhitePart and workspace.goal2
local goal2 = workspace["Home Goal"].RedPart and workspace.goal1
local ball = workspace.TPS
local originalPosition = ball.Position
ball.Touched:Connect(function(part)
if part == goal2 then
val.Value += 1
if val.Value > 7 then
val.Value = 0
end
elseif part == goal1 then
val1.Value += 1
if val1.Value > 7 then
val1.Value = 0
end
end
end)
LocalScript
inside StarterGui
:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local gui = script.Parent:WaitForChild("Start", math.huge)
local val = ReplicatedStorage:WaitForChild("ajax", math.huge)
local val1 = ReplicatedStorage:WaitForChild("inter", math.huge)
gui.Scoreboard.AjaxScore.Text = val.Value
val.Changed:Connect(function()
gui.Scoreboard.AjaxScore.Text = val.Value
end)
gui.Scoreboard.InterScore.Text = val1.Value
val1.Changed:Connect(function()
gui.Scoreboard.InterScore.Text = val1.Value
end)
it changes the value but not the gui
Copy the updated version of my server script, I made the val typo😐
it works now!! thank you so much
1 Like