While standing on a part.... this happens (event)

Hi guys, I’m making a sword fighting arena where there are two plates that are supposed to teleport the players to the arena. I want it so if a player stands on a part, it turns blue, it stops them from moving and if there is a player on both parts then a ‘playButton’ gui pops up which when clicked teleports them both to a separate part inside the arena. I have been trying to do this for two days and i’m very new to scripting, I have got quite close to being able to do it but then find bugs and start over… heres what I have got so far…



I’d really appreciate if someone could explain what i’m doing wrong or fix my script, thanks!

edit: also after i test it, i often get that when i walk onto the plate it turns blue, then i press the leave button on the gui and it is supposed to go back to being grey which at one point it did do that, but when i went to walk BACK onto it, it stayed grey and didnt turn blue, so its like the script only works the first time a player walks on it and it is just broken until i restart the server… im not sure how to fix this either

It’s a local script, not a server script so the changes are only visible to the client and not the server. Try using remoteEvents/remoteFunctions to send information to the server.

1 Like

Hi, thanks for the response, sorry i’m really new to scripting, how do you use remoteEvents? Would it be better to put all this script inside the parts rather than server script?

No need to put the script inside the part. If you want to learn how to use remote events or remote functions, you should watch alvinblox’s tutorials.

1 Like

By the way, if the post above helps and your problem is solved, make sure to mark it as solution and close the topic.

1 Like

So, any changes I want to make to the part I should do through remote events/functions? Also do you know how i would identify if there is a player on both plates which then triggers a gui to pop up?

You could use two RemoteEvents and two LocalScripts for that, and listen for them inside a server Script.

1 Like

thanks, where would i put the local scripts, inside startergui or inside the parts?

I would put the LocalScripts inside the parts, since they will be the ones that detect when a player touches the part.

1 Like