i am trying to run a code for every player in the game using for i, v blah blah but instead it loops through one player (the player it loops through is the one that pressed the button and triggered the event), please help me fix it.
local e = game.ReplicatedStorage.Value.Value
local players = game:GetService("Players")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(Character)
game.ReplicatedStorage.t.OnServerEvent:Connect(function()
Loop()
end)
end)
end)
function Loop()
e = true
for _, plr in pairs(players:GetPlayers()) do
if plr.Character then
spawn(function()
for i = 60, 0, -1 do
wait(1)
end
e = false
print("loop stopped")
end)
while e do
plr.Character:WaitForChild("Humanoid").Jump = true
wait()
end
end
end
end

4 comments
try including lines 23-26 into the spawn function
why lol
bc it yelds the code? there's no reason to have lines 16-22 inside the spawn if 23-26 aren't (reading code again, I think you may need to create a new spawn function)
that breaks the whole script..