Issue with FireClient

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)

Yeah mb I sent the old version. I noticed that aswell and moved it back up to the top of the script which didnt seem to help.

Heres what it looks like now:

		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

Also, why not use OnServerEvent?

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

Don’t you use OnClientEvent when going from Server → Local Player?

No,

If you want to Send Data from Server -> Client, you use OnServerEvent

If you want to Send Data from Client -> Server you use OnClientEvent

same is with a RemoteFunction, Only difference is InvokeServer, and InvokeClient

1 Like

If you’re receiving stuff from server, it’s OnClientEvent and Vice versa for OnServerEvent. That’s what Cairo means (I hope)

OnClientEvent() - Used in Local scripts
OnServerEvent() - Used in Server scripts

1 Like

So he did it backwards pretty much? Lol

1 Like

Pretty much, yes

erkjgnermgkloergjregiuerjklg

1 Like

Yeah thats what ive been using though…

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

Any ideas for a better way to do it instead of just changing walkspeed? That was my original intention

You could anchor all the player limbs with a loop.

for i,v in pairs(character:GetChildren()) do
v.Anchored = true
end

Do “v.Anchored = false” to let them m o v e i t again.

Also path “character” to player character :ok_hand:

The only thing that I can think of is Enabling and Disabling the Anchored on the HumanoidRootPart and

Thanks for the help means a lot

1 Like

You just said it completly wrong, its the other way.

OnServerEvent only works on the Server, FireServer only works on the client

Server to Client

While OnClientEvent and FireClient being the exact opposite

(oof, i see what you mean)

What do you mean, what’s not working?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.