Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a custom animation for just one seat?

I have tried many scripts but none of them work. May somebody help me out? I am trying to make a vibe game.

1 answer

You can detect a person's Humanoid.Sitting property. If it's true, then load him an animation.

This is a script if you want to detect someone is sitting on the seat:

script.Parent.ChildAdded:connect(function(weld)
    chr =  weld.Part1.Parent -- That is the character that is sitting in the seat.
    plr = game.Players:GetPlayerFromCharacter(chr)
    	-- code goes here.
end)

This is a script of how to run an animation:

PLEASE NOTE: MAKE THIS A LOCAL SCRIPT

local anim = Instance.new("Animation", script) 
anim.AnimationId = "http://www.roblox.com/asset/?id=AnimationId" -- Consider replacing "AnimationId" as your animation ID. Please do not leave it.
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:FindFirstChild("Humanoid") --Find the humanoid

if humanoid then --If the humanoid is real...
	local animation = humanoid:LoadAnimation(anim)
	animation:Play()
end

Combine them:

script.Parent.ChildAdded:connect(function(weld)
    chr =  weld.Part1.Parent -- That is the character that is sitting in the seat.
    plr = game.Players:GetPlayerFromCharacter(chr)
local humanoid = chr:FindFirstChild("Humanoid") --Find the humanoid from chr
    	local anim = Instance.new("Animation", script) 
	anim.AnimationId = "http://www.roblox.com/asset/?id=AnimationId" -- Consider replacing "AnimationId" as your animation ID. Please do not leave it.

		if humanoid then --If the humanoid is real...
		local animation = humanoid:LoadAnimation(anim)
		animation:Play()
	end
end)


if humanoid then --If the humanoid is real...
	local animation = humanoid:LoadAnimation(anim)
	animation:Play()
end

3 comments

0

Source from EzraNehemiah_TF2 and laughablehaha.

0

If you have any questions or it didn't work, i will try to respond and fix it ASAP. thanks for reading, and if it worked, consider marking this an answer, i spent a lot of time on this!

0

Ty for answering! It helped a lot!

This discussion is preserved as it was. New answers, comments, and votes are closed.