I added the disc in there and the position for it. But another problem is that, if I move the radio anywhere else, it like makes the disc in the same position and not with the slot. And by "can work anywhere" I mean when I move the model, the function should still work like the other ones. This is the script with the disc and the video of what it looks like:
Script:
-- Validark Script (THANK YOU SO MUCH)
local button = game.Workspace.Button
local slot = game.Workspace.Radio.Slot
local disc = workspace.PlainDisc
local cover = game.Workspace.Radio.Cover
local home = cover.CFrame
local slot_Open = false
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
if not debounce then
debounce = true
spawn(function()
if not slot_Open then
for t = .12, 4.8, 0.18 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)
disc.Position = Vector3.new(14.046, 2.142, -7.38) --Disc position when it opens
disc.Rotation = Vector3.new(90, 90, 0) -- Disc into this rotation
end
else
for t = 4.8, .12, -0.18 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)
disc.Position = Vector3.new(14.046, 2.142, -5.55) --Disc Position when it closes
disc.Rotation = Vector3.new(90, 90, 0) -- Disc into this Rotation
end
end
end)
wait(not slot_Open and .5 or 0)
for a = 1,16 do --This "for" loop runs through each value of the table
slot.Position = slot.Position + Vector3.new(0, 0, (slot_Open and 0.114375 or -0.114375)) -- Only for Z value
wait(.01)
end
slot_Open = not slot_Open --Change it to open if it was closed, or closed if it was open
debounce = false
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Link of Video: https://www.youtube.com/watch?v=1pyVtb6pDeQ&feature=youtu.be
