Set variable on spawn and replication [solved]

Hello everyone. I’m trying to replicate the player’s team variable and a bone after respawning. Actually, if the player’s team number equals 1, I wanna hide the player’s bone. but there is a problem. (I don’t get the team selection variable from a player state and I’ve made the variable exposed to spawn so I can give the value directly on spawn. It was working but after some changes on other things, somehow it got broken). I wanna when I press Z, the bone of the player gets hidden and it works perfectly for the server and clients too. but the problem is after respawning. when I press the respawn button, It will create another instance of the player and I give it the player’s team id, but after respawning, the constructor of the new player, should hide the bone again based on the team number but it doesn’t hide it! I realized that somehow although I give the player’s team id to the new spawned player, it actually sets the default value to the team id variable and this is the problem! and with the default variable, nothing happens and the bone won’t hide. this works perfectly on standalone mode.
(change body color events are the changing bone, at first I wanted to change the color and I didn’t change the name of the events)
https://s16.picofile.com/file/842500…_Selection.png
https://s16.picofile.com/file/842500…ionProcess.png
https://s16.picofile.com/file/842500…awnProcess.png


https://s16.picofile.com/file/842500…riableInfo.png

Problem solved.
I have to pass the replicated variable to the events and this fixes the set variable on the spawn problem.
and have to insert a 0.0 delay to fix the server replication problem.

1 Like