When I remove the loop the GUI displays and the wins value goes up, I'm trying to stop players from touching the end brick multiple times to get infinite wins. However nothing happens when I add the loop back. Why is this?
This is inside the end brick.
local Finish = script.Parent
Winners = {}
Finish.Touched:Connect(function(touch)
for i, v in pairs (Winners) do
if v == touch.Parent.Name then
--oof, you've already finished
else
if touch.Parent.Humanoid then
local touchParent = touch.Parent.Name
local Player = game.Players:FindFirstChild(touch.Parent.Name)
Player.leaderstats.Wins.Value = Player.leaderstats.Wins.Value + 1
table.insert(Winners, Player.Name)
game.ReplicatedStorage.PlayerWins:FireAllClients(touchParent)
end
end
end
end)
