So I'm trying to make a model with a primary part slide up and down on every click (Up on click one, Down on click two), but when I click it. Bam, nothing! Nor no errors.
function click()
if(script.Parent.Status.Value)=="Closed" then
script.Parent.Status.Value="Opening"
movements=0.2
speed=0.2
for i=1,movements do
wait(0.01)
script.Parent.PLT:SetPrimaryPartCFrame(script.Parent.PLT.PrimaryPart.CFrame + Vector3.new(0,speed,0))
end
script.Parent.Status.Value="Open"
elseif(script.Parent.Status.Value)=="Open" then
script.Parent.Status.Value="Closing"
movements=0.2
speed=0.2
for i=1,movements do
wait(0.01)
script.Parent.PLT:SetPrimaryPartCFrame(script.Parent.PLT.PrimaryPart.CFrame + Vector3.new(0,-speed,0))
end
script.Parent.Status.Value="Closed"
end
end
script.Parent.PLT.ClickDetector.MouseClick:connect(click)

1 comment
Put some prints in your code, it'll tell you where you went wrong.