local Players = game:GetService("Players")
local Teams = game:GetService("Teams")
local rs = game.ReplicatedStorage
local red = rs.teamre:WaitForChild("red")
local blue = rs.teamre:WaitForChild("blue")
local green = rs.teamre:WaitForChild("green")
local yellow = rs.teamre:WaitForChild("yellow")
local Amount = 1
-- Function to add +1 to the leaderstat of players on the yellow team
local function updatered(Red,Amount)
for _,player in pairs(game.Players:GetChildren()) do
if player.Team.Name == Red then
player.leaderstasts.Wins.Value += Amount
end
end
end
local function updateblue(Blue,Amount)
for _,player in pairs(game.Players:GetChildren()) do
if player.Team.Name == Blue then
player.leaderstasts.Wins.Value += Amount
end
end
end
local function updategreen(Green,Amount)
for _,player in pairs(game.Players:GetChildren()) do
if player.Team.Name == Green then
player.leaderstasts.Wins.Value += Amount
end
end
end
local function updateyellow(Yellow,Amount)
for _,player in pairs(game.Players:GetChildren()) do
if player.Team.Name == Yellow then
player.leaderstasts.Wins.Value += Amount
end
end
end
red.OnServerEvent:Connect(updatered)
blue.OnServerEvent:Connect(updateblue)
green.OnServerEvent:Connect(updategreen)
yellow.OnServerEvent:Connect(updateyellow)
For some reason it isn’t updating the wins leaderstat, does anyone know why?