Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago
Edited 6 years ago

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):

01local path = require(game.ServerScriptService.Modules:FindFirstChild("NoirPhoenix's Pathfinding"))
02local Target = workspace.Portal:WaitForChild("Target")
03 
04 
05game.ReplicatedStorage.Events.Challenge.OnServerEvent:Connect(function(plr,ePlr)
06        print(plr)
07        print(ePlr)
08 
09        plr.PlayerScripts:WaitForChild("ControlScript").Disabled = true
10        ePlr.PlayerScripts:WaitForChild("ControlScript").Disabled = true       
11 
12 
13 
14 
15        path.new(plr.Character,Target)
16        path.new(ePlr.Character,Target)
17 
18end)
1
Bcuz you cant get PlayerScripts from server script. You need to fire client from server, and on client get it HaveASip 494 — 6y
1
i think you could just copy the control script and paste it inside starterplayer in one of the folders and disable it User#23365 30 — 6y
1
put it in StarterPlayerScripts i tested it and it works lol User#23365 30 — 6y
1
No dude, he cant disable it with script. He need to fire the client from server and on client localscript disable it HaveASip 494 — 6y
View all comments (4 more)
0
I only want to disable it after both players agree to dual. NoirPhoenix 148 — 6y
1
i suggest just making the humanoid's WalkSpeed and JumpPower to 0 if you dont want the character to move User#23365 30 — 6y
0
The idea was to disable the clients movement but my pathfind script to move the plr over to a targetted area. NoirPhoenix 148 — 6y
1
k User#23365 30 — 6y

1 answer

Log in to vote
1
Answered by
HaveASip 494 Moderation Voter
6 years ago

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

01----[[ Server script ]]-----
02local path = require(game.ServerScriptService.Modules:FindFirstChild("NoirPhoenix's Pathfinding"))
03local Target = workspace.Portal:WaitForChild("Target")
04local event = game:GetService("ReplicatedStorage").Events:WaitForChild("Challenge")
05 
06 
07event.OnServerEvent:Connect(function(plr,ePlr)
08        print(plr)
09        print(ePlr)
10 
11 
12        event:FireClient(plr, true)
13        event:FireClient(ePlr, true)
14 
15 
View all 31 lines...
0
Thankyou. :) NoirPhoenix 148 — 6y
0
You are welcome. HaveASip 494 — 6y
Ad

Answer this question