Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Trying to get a sitting animation seat for only one seat, can someone help?

Asked by
o_Khoi 4
5 years ago

I've just created a sitting animation, and I want to make it that if I sit down on a chosen seat it will use my animation, but for my other seats it won't. Can anyone help me?

0
Try getting the seat ocuppant and setting the animation for him Leamir 3138 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago

check when a child is added that is a weld and is named "SeatWeld"

script.Parent.ChildAdded:Connect(function(c) -- when a child is added (assuming the parent is the seat)
    if c:IsA("Weld") and c.Name == "SeatWeld" then -- if the added child is a weld and is named "SeatWeld"
        if c.Part1.Parent:FindFirstChildOfClass("Humanoid") then -- if the script finds a humanoid
            local anim = Instance.new("Animation") -- makes the animation
            anim.AnimationId = "rbxassetid://AssetIdHere"  -- sets the id of it
            local track = c.Part1.Parent:FindFirstChildOfClass("Humanoid"):LoadAnimation(anim) -- loads the animation
            track:Play() -- plays the animation
        end
    end
end)
0
local script or just a script? o_Khoi 4 — 5y
0
a script in the seat the8bitdude11 358 — 5y
Ad
Log in to vote
-2
Answered by 5 years ago

https://www.robloxdev.com/api-reference/class/Seat

0
yeah i was lazy enough to not make it a link TheluaBanana 946 — 5y

Answer this question