I'm trying to move a local script into the player at a certain point so I can detect player input, and move said local script out after once a certain condition is met. However for whatever reason I the code cannot even find "PlayerScripts" inside the player.
ProximityPrompt.Triggered:Connect(function(plr) Seat:Sit(plr.Character.Humanoid) player = plr local ClientSideScript = Vehicle.ClientVehicleScript:Clone() ClientSideScript.Parent = plr.PlayerScripts Seat.ProximityPrompt.Enabled = false end)
Based on the nature of this issue I thought it has something to do with filtering enabled and all that jazz with not being able to edit things from the client. However, this whole code is running from a server script so I have no clue why I would be getting the error " PlayerScripts is not a valid member of Player"
Player scripts cannot be seen from the server. You can see this for yourself by going into Roblox Studio and testing server sided, then going into your player object. You will see that there is no player scripts folder.
There is another way you can do this, if you set up a remote event and fire the client from this proximity trigger, you can make a local script inside of the player scripts to run.
Ex:
-----SERVER SCRIPT--------- local event = game.ReplicatedStorage:WaitForChild("RemoteEvent") ProximityPrompt.Triggered:Connect(function(plr) Seat:Sit(plr.Character.Humanoid) Seat.ProximityPromptEnabled = false event:FireClient(plr, Vehicle) end) -----CLIENT SCRIPT--------- local event = game.ReplicatedStorage:WaitForChild("RemoteEvent") local players = game:GetService('Players') local player = players.LocalPlayer event.OnClientEvent:Connect(function(vehicle) local ClientSideScript = Vehicle.ClientVehicleScript:Clone() ClientSideScript.Parent = player.PlayerScripts end)
I have not tested this code yet, but it should work. If not I think you get the general idea of it. Fire the client from the server and the client runs the code instead.