When I press play, there’s no errors showing in the output and my script doesn’t work.
Any tips on how to fix this?
Here’s my script:
When I press play, there’s no errors showing in the output and my script doesn’t work.
Any tips on how to fix this?
Here’s my script:
where is the script located and what type of script is it?
The script is located in a proximity prompt and it’s a local script.
I’m assuming the ProximityPrompt is in the workspace?
where is the proximity prompt located?
Yes, it is. It’s located in a part.
LocalScripts only run in objects owned by the client, e.g. the player & the player Guis & the character
So then shouldn’t it produce an error telling me that?
you need to put the localscript in something like starterplayerscripts and reference the proximityprompt from there.
It doesn’t produce an error because it doesn’t run in the first place
No, it’s not running at all, so there’s no error to be shown.
So now I have a new issue, it’s telling me “Part” is not a valid member of “Workspace” even though part is in workspace.
thats happening because your client didnt manage to load all children of the workspace in time. You need to include :WaitForChild() in your localscripts when referencing something in workspace. That makes the client script wait for the part to actually exist before trying to “use” it
local pilotSeat = workspace:WaitForChild(“Banshee Class Fighter”):WaitForChild(“pilotSeat”)
local function enterShip()
…
end
workspace:WaitForChild(“Part”):WaitForChild(“ProximityPrompt”).Triggered:Connect(enterShip)
This seems to get rid of the error. Despite the fact it’s showing "infinite yield possible on “Part”, the script still doesn’t make my character sit on the seat. If you have any ideas on why that may be let me know! If I could give you multiple solutions I would
I feel like this would be better in a regular server script based on the context I’ve seen so far.
All I’m trying to do is make it sit the player on the seat, that’s all. I think it should work in a local script no?
It would, but all you’re doing is making someone sit. By doing it in a server script you wouldn’t have to worry about the part being loaded as much.
Also it doesn’t look like you’re positioning them to the actual seat, and you’re just making them sit wherever it is they’re standing when they activate the prompt.