How come this doesn’t seem to work? Im trying to fire the player name in a table into a localscript to re-enable that players movement. I feel like im looking at the issue and am blind or something. Thanks!
for _, plr in pairs(InRound) do
table.insert(InLobby, plr)
local DTC = table.find(InRound, plr)
table.remove(InRound, DTC)
print(plr .. ' has been removed from the "InRound" table!')
print(InRound)
EnableMove:FireClient(plr)
end
You are removing the player from the table, since the Player in that table is now considered nil to the script, it wont fire (Take this with a grain of salt however)
for _, plr in pairs(InRound) do
EnableMove:FireClient(plr)
table.insert(InLobby, plr)
local DTC = table.find(InRound, plr)
table.remove(InRound, DTC)
print(plr .. ' has been removed from the "InRound" table!')
print(InRound)
end
since you are trying to enable the Players (Assuming to the Server), use OnServerEvent rather than OnClientEvent, since it has the Player as its first argument
This could be the issue; you need to reverse the for loop. Also, you don’t really need any remote events for this one; if all you are doing is allowing the player to move, why not just do it from the server?
local function EnableMove(player: Player)
local character: Model = player.Character or player.CharacterAdded:Wait()
character.Humanoid.WalkSpeed = 16
end
for index = #InRound, 1, -1 do
local player = InRound[index]
table.remove(InRound)
table.insert(InLobby, player)
EnableMove(player)
end