How to make a part go down after touching another part

I wanted to make that if you touch another part (which i can do) a wall slowly and smoothly goes down by 10 studs in 30 seconds

You can use the TweenService for it!
simply do:

local TweenService = game:GetService("TweenService")
local TouchPart:BasePart = nil -- Replace with the part you want to detect the touch of.
local Wall:BasePart = nil -- Replace with the wall part.

local TargetPosition = Wall.CFrame.Position - Vector3.new(0,10,0) -- Set the target position to 10 studs below.
local AlreadyMoving = false
TouchPart.Touched:Connect(function()
    if AlreadyMoving then return end -- If we already moved then dont do anything.
    AlreadyMoving = true
    local Tween = TweenService:Create(
        Wall, -- Part to tween
        TweenInfo.new(30, Enum.EasingStyle.Linear), -- Tween in 30 seconds linearly.
        {
            Position = TargetPosition -- Tween the position to this value
        }
    )
    Tween:Play() -- Play the tween
end)

Just make sure the touch part has CanTouch on!

1 Like

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