Server script acts unable to acces server side instances

I was trying to get the PlayerModule to stop the player from moving, the problem is that the PlayerScripts instance doesn’t exist in the server for some reason.

Code:

print(game:GetService("Players"):GetPlayerFromCharacter(hit.Parent):GetChildren() , game:GetService("RunService"):IsServer())
		local controls = require(game:GetService("Players"):GetPlayerFromCharacter(hit.Parent).PlayerScripts.PlayerModule):GetControls()

Output:
11:24:44.686 ▼ {
[1] = StarterGear,
[2] = PlayerGui,
[3] = leaderstats,
[4] = Backpack
} true - Server - CollectionServiceActivator:24
11:24:44.698 PlayerScripts is not a valid member of Player “Players.boyparis” - Server - CollectionServiceActivator:25

It’s intentional, you have to use a RemoteEvent.

But isn’t PlayerScripts NOT accesible from the client?

PlayerScripts is accessible only from the client, not from the server, as your error states.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.