#(SOLVED) How do I get the door to translate down instead of rotating?

1 messages · Page 1 of 1 (latest)

frank pewter
#

I'm not sure if this is the right channel, but I'm following a youtube tutorial on how to make doors open in a game with generated rooms. The doors generate in each room. I tried asking about it in the maker of the tutorial's discord server but nobody responded. The script to make the door rotate open is as follows:


local door = {}

function door.Open(doorModel)
    doorModel:SetAttribute("Open", true)
    
    local cframe = doorModel.Hinge.CFrame * CFrame.Angles(0, math.rad(100), 0)
    local doorTween = TweenService:Create(doorModel.Hinge, TweenInfo.new(1.5), {CFrame = cframe})
    
    doorTween:Play()
end

function door.New(roomModel, number)
    local doorModel = workspace.Door:Clone()
    
    doorModel:PivotTo(roomModel.Exit.CFrame)
    doorModel:SetAttribute("Open", false)
    doorModel.Sign.SurfaceGui.Frame.TextLabel.Text = number
    
    doorModel.Sensor.Touched:Connect(function(hit)
        local humanoid = hit.Parent:FindFirstChild("Humanoid")
        if humanoid and doorModel:GetAttribute("Open") == false then 
            door.Open(doorModel)
        end
    end)
    
    doorModel.Parent = roomModel
    
    return doorModel
end

return door```

How can I edit this script to make it transform down instead of rotating? Do I need to add any objects/welds in the workspace? Thanks!
late fox
#

im only 6 days into scripting but if i had to guess look into the pivotTo function

#

nvm you alr have that

#

wait maybe try lerp then

#

cuz lerp (linear interpolation) is for like moving between two points

ripe shadowBOT
#

studio** You are now Level 8! **studio