I hit the lid, and it didn't like put it in the position I wanted it to be. This is what the script is:
local lid = game.Workspace.BoxCD.Lid sound = Instance.new("Sound") function onClicked() if onClicked(lid) then lid.CFrame = CFrame.new(9.445, lid.CFrame.Y, lid.CFrame.Z) wait(0.1) lid.CFrame = CFrame.new(8.205, lid.CFrame.Y, lid.CFrame.Z) end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
Sorry if I didn't understand the script. You stated the problem, but you didn't say what you intended the script to do.
In my script, when you click script.Parent.ClickDetector, it makes the lid switch between the two positions of Cframe.X = 8.205 and Cframe.X = 9.445.
local lid = game.Workspace.BoxCD.Lid local sound = Instance.new("Sound") local jammed = false function onClicked() --fires each time the button is clicked if not jammed then jammed = true lid.CFrame = CFrame.new( ((lid.CFrame.X == 8.205) and 9.445 or 8.205), lid.CFrame.Y, lid.CFrame.Z) wait(0.1) jammed = false end end script.Parent.ClickDetector.MouseClick:connect(onClicked)