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!
** You are now Level 8! **