function winner()
for _,v in pairs(game.Players:GetPlayers()) do
v:LoadCharacter()
end
end
while wait(1) do
kills = workspace.LeaderBoard.Blue.Value
script.Parent.Text = ""..kills.."/50"
end
function oops()
print("oops")
if kills >= 50 then
local message = Instance.new("Message")
message.Text = "Red Wins!"
message.Parent = workspace
game:GetService("Debris"):AddItem(message, 2)
wait(1)
winner()
workspace.LeaderBoard.Blue.Value = 0
workspace.LeaderBoard.Red.Value = 0
end
end
game.ReplicatedStorage.customevent.Event:connect(oops)
I need the function "oops" to fire everytime a player dies. I tried using a remote event and a bindable event. No output errors and oops is not being printed.
This is the script that fires the event.
function died (player)
print(player.TeamColor)
game.ReplicatedStorage.customevent:Fire()
if player.TeamColor == BrickColor.new("Bright red") then
workspace.LeaderBoard.Red.Value = workspace.LeaderBoard.Red.Value + 1
print("Red Died")
elseif player.TeamColor == BrickColor.new("Bright blue") then
workspace.LeaderBoard.Blue.Value = workspace.LeaderBoard.Blue.Value + 1
print("Blue Died")
else print("Error Error Error")
end
end
game.ReplicatedStorage.Died.OnServerEvent:connect(died)
The script that fires that event works.
I really just need the if statement to constantly check if the value is 50. I tried using a loop but then it puts the player in a respawn loop. I tried using break to stop the loop but then the loop doesn't resume when the player respawns.

3 comments
What is game.ReplicatedStorage.Died?
A remote event that is fired everytime a player dies.
The only event not being fired is "game.ReplicatedStorage.customevent:Fire()"