Need help with sending objects between clients and server with remoteevent

i want to make a revive system in my game and im sending player to revive as a objectvalue through remote event to server script

the problem is it keeps attempt to index nil or sometimes it revives me instead
where it revives me (here im chosing to revive “h0angg2763”)


the script that caused it: (server side)

where it attempts to index nil: (with output)


the script that caused it: (server side)

i have tried many solutions and look in the documentation about objectvalue and remoteevent and them all did not work

scripts in client side


i think they just occur at server script
please help me thank you

2 Likes

When using :FireServer, don’t provide the player as the first argument. It’s automatically passed when calling FireServer.

Basically, replace line 11 of the client side script with

rs:FindFirstChild("RecoveredSomeone"):FireServer(playerVal, section)
3 Likes

attempt to index nil with loadcharacter()


it happened again

1 Like

I don’t get what line 37 is trying to achieve. It tries to load a character from a value which doesn’t make sense at all

2 Likes

its an object value but i knew it earlier so i removed the value
(i was trying to revive the chosen player)

1 Like

if you want to load a character, you could simply…

game:GetService("Players"):FindFirstChild(playerName):LoadCharacter()
2 Likes

uhmmmmmmmmm i totally forgot about that… :cry::cry::cry:
(will try later)

1 Like

also it still returns attempt to index nil with character, did i do anything wrong?

rp:FindFirstChild("RecoveredSomeone").OnServerEvent:Connect(function(plr, playerval, section)
	game:GetService("Players"):FindFirstChild(playerval.Value):LoadCharacter()

(also i changed it to stringvalue)

1 Like

Well on the server you need to call (player: Player)

rp:FindFirstChild("RecoveredSomeone").OnServerEvent:Connect(function(player: Player, playerval, section)
	player:FindFirstChild(playerval.Value):LoadCharacter()
2 Likes
rp:FindFirstChild("RecoveredSomeone").OnServerInvoke:Connect(function(plr, playerval, section)
	game:GetService("Players"):FindFirstChild(playerval.Value):LoadCharacter()

1 Like

why exactly???

my bad i didnt read the full thing so i never realized that u were returning for something
probably stick to remoteevents, u wont need remotefunctions for that

can you try checking what the value section:FindFirstChild("Player").Value" is?

1 Like

its a object value but it didnt work so i changed it to a string value
then locating the player thru the string value

you cant call :LoadCharacter() on a string, try doing
game:GetService("Players")[section.Player.Value]:LoadCharacter()

1 Like

now it attempts to index nil with the value
seems that the value from the client is a nil
now i just figured how, the value is only client modified so it just only recieve nil value
it is ok to modify the value with normal script?

yea just modify it with a server script

1 Like

I think just to get the player who fired the remote for

1 Like

ooooooh i understand thank you