Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Should I handle spawning players with a serverscript or a localscript?

Basically, I have an AFK button in a gui, and when I click it I want it to turn AFK mode on and off etc etc. When a player joins the game it's initially off, and through the server script I make them spawn in the lobby, but if they enable the AFK button, I want them to spawn in the actual map, but I realise maybe I should handle all this spawning location stuff on a localscript. Would that be more efficient?

6 comments

0

serverscript

0

serverscript

0

how do i make it so when afk is set in a localscript and i use a remote to fire, to check whether a player has afk on or off?

0

Let's put it this way: If you can accomplish what you want in a server script, then do it in a server script.

0

Trecept, that is another question entirely so please ask that in a separate post. I suggest you read up more on FE first, though.

0

serverscript [3]

1 answer

✓ Accepted answer

I think you should have a server script which handles everything and have a BoolValue which is called AFK(or something like that). Then have a LocalScript which handles the AFK button and when that button is pressed it fires a remote event which changes the Value of the BoolValue to the opposite of whatever it is at that time. Then have the server script use the Changed event to detect when the Value is changed. Have the changed event send the player to the main map when AFK is changed to true and lobby when it is changed to false(or whatever you decide). Hope this helps! If you need anymore help just comment below my answer and I will see what I can do. Have a great day scripting!

This discussion is preserved as it was. New answers, comments, and votes are closed.