I want the cover of the chest to open when the lock or key is clicked on by the player. The problem is, when I click on it, my script only rotates the chest door once and it doesn’t recognize the for loop and nothing is shown in the output. I’ve tried turning this into a different function structure. I don’t really know how to adjust this simple script.
local chest = workspace.Chest
local button = chest.Button
local openMech = chest.Open
function Mechanism()
local mechPivot = openMech:GetPivot()
for i = 1,30 do
openMech:PivotTo(mechPivot * CFrame.Angles(math.rad(1),0,0))
end
end
button.ClickDetector.MouseClick:Connect(Mechanism)