I was experimenting with a standing-up animation, to replace the default teleport out of the seat.
There is a seat part with an “Up position”, which is basically a part where the player should stand when it gets up.
Video of what happens:
Script:
script.Parent.Attachment.Sit.Triggered:Connect(function(plr) -- ProximityPropmt
local char = plr.Character;
script.Parent:Sit(char.Humanoid);
char.Humanoid.JumpHeight = 0;
game.ReplicatedStorage.LocalEvents.SeatJumpBind:FireClient(plr); --just fires the "JumpOutOfSeat" when the spacebar is pressed
local con;
con = game.ReplicatedStorage.ServerEvents.JumpOutOfSeat.OnServerEvent:Connect(function(player)
local char = player.Character;
local standAnim = char.Humanoid:LoadAnimation(player.Backpack.Anim.StandUp1);
standAnim:Play();
standAnim.Stopped:Wait();
script.Parent:FindFirstChild("SeatWeld"):Destroy();
wait() -- wait for the weld to be destroyed, if this is not here, the whole thing bugs out
char.Humanoid.Sit = false;
char.HumanoidRootPart.CFrame = script.Parent.Up.CFrame;
char.Humanoid.JumpHeight = 0;
con:Disconnect();
end)
end)
So I assume it does that weird teleporting cuz the animation is not fully over (the transition from the stand-up animation to the idle animation), and when it teleports the character teleports even further. Could be fixed by removing that transition, but I couldn’t find how to do that.
It’s also weird how the character gets launched into the air. The “up” part is 0.1 studs above the normal level of the HRP, so I have no idea why it does that.
Any help is appreciated