I’m working on a game where I want seat animations to be a big part of, but the problem is that you need to touch the seat to play the animation. If I want to reach the seat comfortable, then the animation will make the player float, but if I want the animation to look clean then the seat needs to be positioned so that the seat is inside another part, somewhere unreachable.
Also keep in mind that the first photo of what I want, that isn’t the actual seat and is simply a black part to mimic that of a part. I don’t know what to do, because moving and resizing the seat part doesn’t work, and I’ve tried moving the rig around in the animator but I don’t know what to do. I think the problem might be that it’s focusing on the whole player but I want it to focus on the torso mainly. I’m probably wrong on that but I just don’t know nothing about that, I am more of a builder than a animator or scripter.
You could make it edit the SeatWeld’s C0 with a script like this (This will move your avatar slightly foward)
local Seat = script.Parent
local Offset = 5
Seat.ChildAdded:Connect(function(Child)
if Child:IsA("Weld") then
Child.C0 -= Vector3.new(0,0,Offset)
end
end)
If I make it so you can reach the seat, it will make the player float when playing the animation. But I don’t want the player to float during the animation, so I have to move the seat down so the animation looks clean, meaning the seat can’t be reached.
Why do I want my avatar go forward, it looks fine? The problem is that what I have, makes it so I can’t reach the seat, but if I want to be able to reach the seat, the animation will make the player float.
Also I think this is something to do in the animation, not the code. I also I don’t want to add more hassle and struggle and I simply just need a change in the animation so that avatar is closer to the seat.
im pretty sure that code actually moves your avatar higher when you sit on the seat, or if it doesn’t, replace offset with 0 and the middle 0 with offset
when the player touches the part make their humanoidrootpart teleport cframe to the seat and disable walk by anchoring the humanoid root part and detect if the player jumps, if they jump release the script.
I think your right but I think the offset should be a negative number if I want it to be closer to the seat, right? So that the player goes lower on the y-axis therefore closer to the seat.
I want to add this and change it a bit so that it’ll fit my liking, but where do I put it in this script?
seat = script.Parent
function added(child)
if (child.className=="Weld") then
human = child.part1.Parent:FindFirstChild("Humanoid")
if human ~= nil then
anim = human:LoadAnimation(seat.sitanim)
anim:Play()
end
end
end
function removed(child2)
if anim ~= nil then
anim:Stop()
anim:Remove()
end
end
seat.ChildAdded:connect(added)
seat.ChildRemoved:connect(removed)