This script is from Validark and others that are combined and fixed ALOT. But now, everytime I click it again, the slot goes forward and not backward and the cover like starts over and not go backward to like close it. This is the script and a video of what happened:
Script:
-- Combined script
local button = game.Workspace.Button
local slot = game.Workspace.Radio.Slot
local cover = game.Workspace.Radio.Cover
local home = cover.CFrame
debounce = false
function onClicked(button) --Supposed to work after you click the button and both the slot and cover come out at the same time
spawn(function()
for t = 0, 4.8, 0.03 do
wait(0.001)
local v = math.cos(t / 4.8 * math.pi) * 45 + 90 + 45
cover.CFrame = home
cover.Rotation = Vector3.new(v, 0, 180)
end
end)
local positionZValues = {-5.535, -6.635, -7.365} -- Z Value for Position (I wanted it to be from -5.535 to -7.365)
if not debounce then
debounce = true
for a = 1,16 do --This "for" loop runs through each value of the table
slot.Position = slot.Position + Vector3.new(0, 0, -0.114375) -- Only for Z value
wait(.01)
end
debounce = false
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
---0.114375
Video Link of what happened and a little more explanation: https://www.youtube.com/watch?v=ZCKc4J6Cl5w&feature=youtu.be

2 comments
This is what happened: https://www.youtube.com/watch?v=TidS1Jot8Jk&feature=youtu.be The cover went slower than the slot and it didn't go backward after the slot closed
Thanks for helping me, this is another video of what it looks like. There is a little problem with it though: https://www.youtube.com/watch?v=u6lCkr3WMtE