I'm making a nightstand that has a drawer that opens when it is clicked. I'm using CFrames to do it. The way I am currently doing this is by taking the position when the drawer is closed and then putting that into the script. Then moving the drawer to the position I want it to be at when closed and Cframing that.
Here is the code:
script.Parent.DrawerOpen.Value = false
script.Parent.ClickDetector.MouseClick:connect(function(OpenDrawer)
if script.Parent.DrawerOpen.Value == false then
script.Parent.CFrame = CFrame.new(14, 1.595, 4.59)
script.Parent.DrawerOpen.Value = true
else if script.Parent.DrawerOpen.Value == true then
script.Parent.CFrame = CFrame.new(14, 1.595, 2.99)
script.Parent.DrawerOpen.Value = false
end
end
end)
How can I make this do the same thing no matter where the model is at?
Thanks

1 comment
TechSquad your answer doesn't work, and you cannot use "then" that way.