Stand in a seat

Hello, I am still trying to learn to script but not very decent at it. I was wondering if anyone could help with this,

I’m trying to make a seat, but instead of sitting in it, you stand in it. Possibly even change the positions of arms/legs. But most importantly, just have it so instead of sitting, you stand instead.

I’ve tried looking for other forum posts but nothing has really helped, I tried looking at other scripts from the toolbox but every model I looked at was broken.

2 Likes

If it’s for all seats, you could go inside the default animate script inside the player, change the sitting animation id input with another one or just remove it and edit the other parts that may bug if the sitting animation id child isn’t inside the animation table.

You can use the characteroftheplayer:MoveTo a certain amount of studs above the seat(which will require a little trial and error to get the optimal location) when someone touches a mesh of a seat(use a touch function for a part instead because seat is like kinda just made for sitting lol)

im not on laptop right now, but if you still are having trouble later, I’ll try writing the full code.

Alright, thank you, I’ll try that when I get a chance.

Sadly I have other seats in the game that need to stay as regular seats.

Here’s a thread that should help.

Yeah, you can use the occupant property of a seat and play an standing animation when that property is true. However, if you don’t want animations you could probably cframe the player, assuming that standing position is still. Anyhow you would need to use the occupant property in relation to your method.

Here’s a model I’ve used in the past, made by NVI.
Unfortunately it only works for R6 Characters, but I’m pretty sure if you know about scripting you could add the R15 body parts as well.

U suggest doing the following:

  1. Create a Seat
  2. Parent a stand animation (“SitAnimation”) and a (client/server) script inside it.
  3. Put the AnimationId in the Animation
  4. Use the following script:
local Seat = script.Parent
local anim 

function added (child)
	if (child.className=="Weld") then
		local hum = child.part1.Parent:FindFirstChild("Humanoid")
		if hum and hum:FindFirstChild("Animator") then
			anim = hum.Animator:LoadAnimation(Seat.SitAnimation)
			
			hum.JumpPower = 0.01 -- you won't jump up if you press space
			
			anim:Play()
		end
	 end
end

function removed (child)
	if anim ~= nil then
		anim:Stop()
		anim:Remove()
		local hum = child.part1.Parent:FindFirstChild("Humanoid")
		
		if hum then 
			hum.JumpPower = 50 
		end
	end
end

Seat.ChildAdded:connect(added) -- send once someone is seated
Seat.ChildRemoved:connect(removed) -- send once someone stops being seated
2 Likes

Forgot to update this forum post, I did find a solution, if anyone wants the model I found I can try and find it, thanks everyone for the help.