seat:Sit()
only works on the server. I have a client-side (as in, it ONLY exists on the client) humanoid that needs to sit. I’m looking for a way to recreate the Sit()
function on the client. Help is appreciated!
Couldn’t you just make the humanoid sit from a local script, or if you want control from the server, fire a remote event?
That’s literally what doesn’t work:
seat:Sit()
only works on the server.
I tested it myself.
Humanoids have a Sit
property, which you can toggle true to make them sit. That might work.
That’s a bool value. It only says if the humanoid is sitting or not.
Just call the sit function from server due to a remote event.
--Server
RemoteEvent.OnServerEvent:Connect(function(plr)
SeatObject:Sit(plr.Character.Humanoid)
end)
--Client
RemoteEvent:Fire()
Do you mean that you want the humanoid to sit in a seat, as implied by your code?
Move the humanoid creation to the server. You can do this through a remote if you need to wait, or put the code in starter character scripts.
No. I have my game architecture set up this way for a reason. That is not a solution to this problem either. I’m looking for a way to recreate the sit() function on the client.
You could just weld the humanoid root part to the seat, then set humanoid.Sit to true to play the animation. To undo, delete the weld and set humanoid.Sit to false.
If you decided to weld the player to the actual seat, you would have to handle user input to detect when the player wants to leave the vehicle…
userinputservice → space bar → break weld → teleport player 2 studs above car (or have the player jump)
Exactly what you would have to do. He wants to keep the humanoid local (not sure why) to the player, so this is the best option. You might be able to do humanoid.Jumped, through I’m not sure if that will fire. I think it will though.
Thank you. I had no idea setting the sit property to true would also play the animation. Saves some time.
I think that welding it would be a better alternative, considering that you could have more control over entering the vehicle… example(in jailbreak, you can press E to enter a vehicle if you are close enough - rather than having to touch the seat)
This works for R15, R6, and Rthro. If you wanted, you could create a custom animation instead and play it.
Humanoid.Sit plays the animation and prevents player control. It does not weld the player.
But for roblox “seat” objects, it does weld you to the seat whenever you touch it.
He wants to do this remotely without touching the seat. Read the OP. The seat:Sit function only works on the server.
This is all irrelevant. This wasn’t even for a player, it was for an NPC. My question has been answered.