When you hover your cursor over the drawer it has a little interact GUI that shows up and when you click it slide opens and close.
I have this one problem where if you spam click the drawer it goes more further than it should (I think it has something to do with the script doing running more than it should).
I tried changing the clickdetector activation distance to 0 while it runs then changing it back. Then I added a wait timer after changing it to 0 to wait for the server to keep up.
Script:
local Drawer = script.Parent
local clickDetector = Drawer.ClickDetector
local Gui = Drawer.Parent.Gui2.BillboardGui
local Opened = false
clickDetector.MouseClick:Connect(function()
clickDetector.MaxActivationDistance = 0
wait(0.1)
if Opened == false then
Gui.Enabled = false
for i = 1,25 do
Drawer.CFrame = Drawer.CFrame * CFrame.new(0,0,-0.05)
wait()
end
Opened = true
end
clickDetector.MaxActivationDistance = 10
end)
clickDetector.MouseClick:Connect(function()
clickDetector.MaxActivationDistance = 0
wait(0.1)
if Opened == true then
Gui.Enabled = false
for i = 1,25 do
Drawer.CFrame = Drawer.CFrame * CFrame.new(0,0,0.05)
wait()
end
Gui.Enabled = true
Opened = false
end
clickDetector.MaxActivationDistance = 10
end)

1 comment
ty fam (and no i wrote the script from scratch)