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