I am attempting to make a script that disables a script in the PlayerScripts folder but its coming back with an error I don't know how to fix.
script.Parent.Touched:Connect(function(part) if part.Parent:FindFirstChild("Humanoid") then local player = game.Players:GetPlayerFromCharacter(part.Parent) game.Players[player.Name].PlayerScripts.CameraScript.enabled = false end end)
That is the script. And when ever it runs when a player hits it it comes back with.
PlayerScripts is not a valid member of Player "Players.Xenaside"
(Xenaside is my username)
Anyone know how this can be resolved? I've been trying to fix this for a while now.
If it's a local script, I would suggest putting it in a place where it can actually run (StarterCharacterScripts, StarterPlayerScripts, etc.). You also want an Remote Event in ReplicatedStorage. You need a server script inside of the part you are currently using, and make it communicate with your local script using the remote event.
Another suggestion: If you want the camera to stop moving, you could also use:
local camera = workspace.CurrentCamera -- Get the camera instance camera.CameraType = Enum.CameraType.Scriptable -- Set the CameraType value to "Scriptable", stopping the player from moving it
I hope this helped at least a little bit!