i created simple door open/close script using animations, but they seem to be played twice, with the first half playing. I tried all animation priorities, all the same, only “HumanoidRootPart” is anchored. There is all model:
local Animations = game:GetService("ReplicatedStorage").Animations
local ClickDetector = script.Parent.Torso.ClickDetector
db = false
local Open = script.Parent.Humanoid.Animator:LoadAnimation(Animations.Open) -- Animation Priority = Enum.AnimationPriority.Action
local Close = script.Parent.Humanoid.Animator:LoadAnimation(Animations.Close) -- Animation Priority = Enum.AnimationPriority.Idle
local Holding = script.Parent.Humanoid.Animator:LoadAnimation(Animations.Holding) -- Animation Priority = Enum.AnimationPriority.Idle
ClickDetector.MouseClick:Connect(function()
if db then
Holding:Stop()
Open:Stop(.3)
Close:Play(.3)
db = false
else
Close:Stop(.3)
Open:Play()
Holding:Play(.3)
db = true
end
end)
But yes I wonder the same, using humanoid animations and stuff for parts? That’s really weird. I would recommend just using Motor’s with welds to the door’s parts.
Can i create animation with a motor? Or does he helps with animating? I don’t know anything about the motor other than what offset cameras do with it
If I use a motor, will it be possible to make an animation of twitching the handle? I need to somehow fix this
You could tween the speed of the motors (not laggy) so that would probably be a great thing, you can also make it look like it’s a easing style you want by making it go (if you have the bouncy one) further than needed with a higher speed and then go back, it’s a little harder but would be efficient.
I fixed this adding animation fade (Animation:Play(Fade))
local TweenService = game:GetService("TweenService")
local Animations = game:GetService("ReplicatedStorage").Animations
local Sounds = game:GetService("ReplicatedStorage").Sounds
local click = script.Parent.Torso.ClickDetector
local Open = script.Parent.Humanoid.Animator:LoadAnimation(Animations.Open)
local Close = script.Parent.Humanoid.Animator:LoadAnimation(Animations.Close)
local Holding = script.Parent.Humanoid.Animator:LoadAnimation(Animations.Holding)
Open.Priority = Enum.AnimationPriority.Idle
Close.Priority = Open.Priority
Holding.Priority = Enum.AnimationPriority.Movement
db = false
click.MouseClick:Connect(function()
if db then
click.MaxActivationDistance = 0
if script.Parent.Torso:FindFirstChild("Open") then script.Parent.Torso.Open:Destroy() end
wait(.2)
Holding:Stop(.5)
Open:Stop(.5)
Close:Play(1.45)
wait(.6)
local s = Sounds.Close:Clone() s.Parent = script.Parent.Torso s:Play()
click.MaxActivationDistance = 14
db = false
else
click.MaxActivationDistance = 0
if script.Parent.Torso:FindFirstChild("Close") then script.Parent.Torso.Close:Destroy() end
Holding:Stop(.5)
Close:Stop(.5)
Open:Play(1.2)
local o = Sounds.Open:Clone() o.Parent = script.Parent.Torso o:Play()
script.Parent.Torso.Open:Play()
wait(Open.Length)
Holding:Play()
click.MaxActivationDistance = 14
db = true
end
end)