Nothing is working, scripts, etc

A seat needs to be touched to have them sit in it. By doing “Humanoid.Sit” you’re just enabling a property. This allows you to make someone sit wherever they’re at, it doesn’t exactly position them to any specific spot.

I haven’t worked with seats for a while, but I did a quick test and, while it may not be the best solution, you could set the character’s HumanoidRootPart’s CFrame to the seat’s CFrame, which would force your character to touch it and sit automatically.

I would format my code like this (with the script in ServerScriptService):

local seat = workspace["Banshee Class Fighter"].pilotSeat
local prompt = workspace.Part.ProximityPrompt

local function enterShip(player)
    if player.Character then
        local humanoid = player.Character:FindFirstChildWhichIsA("Humanoid")
        if humanoid then
            player.Character.HumanoidRootPart.CFrame = seat.CFrame
        end
    end
end

prompt.Triggered:Connect(enterShip)

First time formatting code on here so hopefully this works. See if this does anything and get back to me.

1 Like

I would give you a solution but I can’t give out two, but thank you for your help!

No problem! A quick explanation of the above to help you out:

  • Can do “workspace…” instead of “game.Workspace”. Not a huge thing though, both do the same thing.
  • Since everything is already in the workspace and you’re using a script, you can assume all the parts have been loaded, so there’s no need for “WaitForChild”. Not true in all cases though (for example, if something is added to the workspace after the game starts).
  • Instead of getting the player in the function, the “Triggered” event passes the player that triggered the prompt as an argument, so that’s where we get the character from.
  • Could add an additional if-statement after checking for the humanoid by checking to see if the player’s health is above 0, but not a big deal.
  • Don’t need to check for the seat to exist in the function since it’s defined in a variable at the top.
  • And lastly I’m using CFrame because if you used Position, it would only move your HumanoidRootPart and not everything attached to it. I unfortunately don’t know why though.

And lastly I’m using CFrame because if you used Position, it would only move your HumanoidRootPart and not everything attached to it. I unfortunately don’t know why though.

Setting the position property only updates the position. Setting the cframe updates all orientation, position and weld data

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.