points = script.Parent.Parent.Parent.Parent.leaderstats.Points

script.Parent.Text = "points: "..points.Value
points.Changed:connect(function()
	script.Parent.Text = "points: "..points.Value
end)
local Homepoints = 0
local Awaypoints = 0

local UpdateEvent = Instance.new("RemoteEvent")
UpdateEvent.Name = "UpdateWinner"
UpdateEvent.Parent = game.ReplicatedStorage

for _,plr in pairs(game:GetService("Teams").Home:GetPlayers()) do
   Homepoints = Homepoints + plr.Backpack.leaderstats["Team points"].Value
end
for _,plr in pairs(game:GetService("Teams").Away:GetPlayers()) do
  Awaypoints = Awaypoints + plr.Backpack.leaderstats["Team points"].Value
end
if Homepoints> Awaypoints then
    
    UpdateEvent:FireAllClients("Home")
elseif Awaypoints > Homepoints then
    
    UpdateEvent:FireAllClients("Away")
else
   
    UpdateEvent:FireAllClients("Neither")
end~~~~~~~~~~~~~~~~~

The script wont work, can anybody help? Also, how would I do it so if the ball touches certain part the team/player gets points (please dont delete i need help.)

1 comment

0

Try putting your whole script in code blocks so it's easier to read. Thanks!