maybe exploiters were spoofing their UserId cuz it replicated from client to server
@KnightTakami This thread is about the Player instance being created on the server, but your code examples reference something completely different (a part in Workspace). I donât really see the connection here? This is a very confusing thread to read. Are you saying that thereâs going to be an entire paradigm shift on the way replication is handled on the platform as a whole?
WaitForChild is still a relatively new feature, so a lot of games donât use it â and, in cases where it was not required, it has been considered to be bad practice by some to use excess WaitForChild calls. Local scripts donât run until the game is fully loaded by the client (unless theyâre in ReplicatedFirst), and what youâre saying implies that this will change. I hope thatâs not the case.
Previously, PlayerScripts didnât exist on the server at all, and PlayerGui contents were copied from StarterGui by the client. Additionally, items dropped into the PlayerGui would only replicate to that player specifically. Is this going to be the continued behavior after this update?
None of what you said is relevant to what Iâm talking about. Exploiters will ALWAYS be able to modify Workspace for their own clientâŚ
If they werenât able to, then we wouldnât be able to make our own parts in a LocalScript. Thatâs not what this thread is talking about.
This is probably unrelated but while weâre on the topic of the Player object id like to bring this up. The Player object has been missing from the Object Browser in studio for a long time (over a year). Will we be seeing this added soon?
Iâm not too sure about this one. Player object represents a user in the game. Were you using it for something specific? (But honestly, Iâm not sure about this particular question)
I think because of the way team create works if you could spawn player objects it would show that in the player count of the game on-site but Iâm not 100 percent on that
Heâs referring to the Object Browser window that shows a (really ugly and underdeveloped compared to the wiki) explanation of the properties, methods, and events of an object.
To clear up confusion:
The post is meant to say, that you should continue to do what you should already be doing. This update will make no difference to you as a developer, but changes a lot behind the scenes.
If you ever reference an object on the client that is created by the server, you should always use WaitForChild() game.Workspace:WaitForChild("Part")
In LocalScripts, you can use game.Players.LocalPlayer
to reference the Player object, LocalPlayer will never be nil.
You should always use LocalPlayer:WaitForChild("PlayerGui")
, when referencing the clientâs PlayerGui or any object inside the Player, because it is an object that is created by the Server later on in the join-game process.
Thatâs not whatâs being implied, as shown by the NicePart example, and for the fact that he said youâll need to WaitForChild for it even if it was created in studio. Whatâs the explanation for that if Iâm missing one?
If I was doing something with NicePart and it was already created in studio, I would just use workspace.NicePart
. I wouldnât use workspace:WaitForChild("NicePart")
because it shouldnât be necessary. Am I going to have to always opt for the latter?
There is a chance that LocalScripts will run before NicePart is replicated to the client. So your script should hang with game.Workspace:WaitForChild("NicePart")
until it is replicated.
If you are 100% sure that an object is replicated before a script runs, such as while youâre in Studio. then feel free to use game.Workspace.NicePart
.
But if youâre developing for a game that players are joining, youâll want to use WaitForChild() so you can wait for the object to replicate.
I thought playerguiâs existence is guaranteed now?
https://devforum.roblox.com/t/multiple-levels-in-waitforchild-looking-for-feedback/90528/27
I donât believe thatâs the case. Local scripts donât run until the game has been fully replicated to the client. If the serverâs still sending game data to the client for the initial load, the scripts will not start until thatâs finished (unless your script is in ReplicatedFirst).
If I created NicePart in studio, then I would have zero problem indexing it as normally (workspace.NicePart
). I never have. This changes that, and I have problems with the OP saying this is an invisible change that developers wonât notice.
I believe the OP was saying that in LocalScripts you should write game.Workspace:WaitForChild("NicePart")
when writing code for production ( players joining games ). You can continue to use game.Workspace.NicePart while in studio or in places where you know the object exists.
I think thatâs what he was saying too â which implies a very big change from the status quo. What the OP said implies that LocalScripts will begin to run immediately after they are replicated, which is troubling. Thereâs no reason to make that change since we have ReplicatedFirst anyways. Iâm hoping OP just made an error in his example. Roblox has no reason to change this behavior so late in the platformâs life â especially when itâs just a major inconvenience and provides no benefit to the developer.
From how current things are, yes, the client is able to modify workspace to a full extent (even if people on other clients wonât see the changes) due to workspace copying over to the client; however, if workspace would be fully ran by the server and not duplicated over to the client when players join, clients would only be able to add parts so only they will see them and can only remove/modify parts theyâve added themselves, so localparts would still work.
This is based off of assumption this will happen the way Iâve described it. I might have gotten offtrack a little bit, but this mechanism theyâre adding has tons of potential.
LocalScripts already, to this date, run as soon as they are replicated. This is always how it has been.
From the sounds of it, this feature only affects people who are doing loading stuff at the very beginning of a play session, when the place is being loaded by the client.
Can you give insight on the necessity of using :WaitForChild()
in local scripts with the following initialization conditions?
- StarterPlayerScripts
- StarterCharacterScripts
- ReplicatedFirst
- StarterGui
- Local script delivered to client when server script detects player joining
- Local script delivered to client when character is created
- Local script delivered to client when character touches a part
So what did you mean by your security comment? What you described is already how it works. Thereâs no way for a client to add new parts to the Workspace with or without this change.
Thatâs not whatâs being implied. Refer back to the answer on whether we have to WaitForChild on parts created in studio.