How would I make a door that shuts downward

So I’ve been trying to work on a script for the past few hours that falls down quick and smooth. I couldn’t quite figure it out, and I’ve looked for a similar ideas for a while now. I’ve made an animation and it will not play when the part to trigger it is touched. Here’s my script:

local FallPart = script.Parent
local Anim = FallPart.DownAnim
local TouchPart = script.Parent.Parent.TouchPart
local hum = FallPart:WaitForChild(‘Humanoid’)

function Touched ()
if hum then
Anim:Play()
end
end

TouchPart.Touched:Connect(Touched)

I’ve tried many other scripts, and none seem to work. Any help would be nice :grinning:

Try use tweenservice that should work

Do you mean something like this?

local ts = game:GetService('TweenService')
local door = script.Parent

local twinfo = TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,-1,true,.3)

local tweengoal = {}
tweengoal.Position = door.Position + Vector3.new(0,10,0)

local tween = ts:Create(door,twinfo,tweengoal)

tween:Play()

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.