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

Why am i receiving an error stating that "PlayerScripts is not a valid member of player"?

Hello i'm trying to disable the "ControlScript" in PlayerScripts which is a folder in the player (similar to 'PlayerGui') But whenever i try to access the 'PlayerScripts' folder i receive the error saying the folder is not a valid member of player...

I've tried using ":WaitForChild", "Repeat wait()" and even for loops but all 3 of those ways are not working and i keep getting the same result. It is very weird and i remember having this problem a while back with the PlayerGui folder but gave up on that project because of that error.

Here is the script as of current (Server Script):

local path = require(game.ServerScriptService.Modules:FindFirstChild("NoirPhoenix's Pathfinding"))
local Target = workspace.Portal:WaitForChild("Target")


game.ReplicatedStorage.Events.Challenge.OnServerEvent:Connect(function(plr,ePlr)
		print(plr)
		print(ePlr)
		
		plr.PlayerScripts:WaitForChild("ControlScript").Disabled = true
		ePlr.PlayerScripts:WaitForChild("ControlScript").Disabled = true		
	
		
			
		
		path.new(plr.Character,Target)
		path.new(ePlr.Character,Target)
	
end)

8 comments

1

Bcuz you cant get PlayerScripts from server script. You need to fire client from server, and on client get it

1

i think you could just copy the control script and paste it inside starterplayer in one of the folders and disable it

1

put it in StarterPlayerScripts i tested it and it works lol

1

No dude, he cant disable it with script. He need to fire the client from server and on client localscript disable it

0

I only want to disable it after both players agree to dual.

1

i suggest just making the humanoid's WalkSpeed and JumpPower to 0 if you dont want the character to move

0

The idea was to disable the clients movement but my pathfind script to move the plr over to a targetted area.

1

k

1 answer

✓ Accepted answer

Bcuz you cant get PlayerScripts from server script. You need to fire client from server, and on client get it

----[[ Server script ]]-----
local path = require(game.ServerScriptService.Modules:FindFirstChild("NoirPhoenix's Pathfinding"))
local Target = workspace.Portal:WaitForChild("Target")
local event = game:GetService("ReplicatedStorage").Events:WaitForChild("Challenge")


event.OnServerEvent:Connect(function(plr,ePlr)
        print(plr)
        print(ePlr)
	
              
		event:FireClient(plr, true)
		event:FireClient(ePlr, true)



        path.new(plr.Character,Target)
        path.new(ePlr.Character,Target)

end)


----[[ Client Script "LocalScript" ]]-----
local player = game:GetService("Players").LocalPlayer
local event = game:GetService("ReplicatedStorage").Events:WaitForChild("Challenge")
local controlScript = player.PlayerScripts:WaitForChild("ControlScript")


event.OnClientEvent:Connect(function(Variable)
	controlScript.Disabled = Variable
end)

2 comments

0

Thankyou. :)

0

You are welcome.

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