I made a script where when you click on the door it opens, but it won't work and also I can't tell whats wrong since nothing is showing up on the output about it
Here is the script
Door = script.Parent.Main:GetChildren() value = script.Parent.value value.Value = 0 function onClick() if value.Value == 1 then return end value.Value = 1 for loop = 1,190 do Door.CFrame = Door.CFrame * CFrame.new(0,0,0.32) * CFrame.fromEulerAnglesXYZ(0, -0.1, 0) wait(0) end wait(3) for loop = 1,190 do Door.CFrame = Door.CFrame * CFrame.New(0,0,-0.32) * CFrame.fromEulerAnglesXYZ(0, 0.1, 0) wait(0) end wait(.1) value.Value = 0 end script.Parent.ClickDetector.MouseClick:connect(onClick)
Can someone tell me what i did wrong?
Well I made your script a bit different when locating the door, value and clickdector. Use this if you don't want it to stop
Door = script.Parent.Main.Door value = Door.Value value.Value = 0 function onClick() if value.Value == 1 then return end value.Value = 1 for loop = 1,190 do Door.CFrame = Door.CFrame * CFrame.new(0,0,0.32) * CFrame.fromEulerAnglesXYZ(0, -0.1, 0) wait() end for loop = 1,190 do Door.CFrame = Door.CFrame * CFrame.new(0,0,-0.32) * CFrame.fromEulerAnglesXYZ(0, 0.1, 0) wait() end --Door.CFrame = Door.CFrame * CFrame.new(0,0,0) * CFrame.fromEulerAnglesXYZ(0, 0.1, 0) --If you want it to act a door you can use this to stop it and click it to open it again. wait(.1) value.Value = 0 end Door.ClickDetector.MouseClick:connect(onClick)
The problem is that you accidentally used New
instead of new
I made a change in the script, but same thing, no error is popping up in the output
I didn't change much either way
Door = workspace.Door.Main:GetChildren() value = workspace.Door.value Click = script.Parent value.Value = 0 function onClick() if value.Value == 1 then return end value.Value = 1 for loop = 1,190 do Door.CFrame = Door.CFrame * CFrame.new(0,0,0.32) * CFrame.fromEulerAnglesXYZ(0, -0.1, 0) wait(0) end wait(3) for loop = 1,190 do Door.CFrame = Door.CFrame * CFrame.New(0,0,-0.32) * CFrame.fromEulerAnglesXYZ(0, 0.1, 0) wait(0) end wait(.1) value.Value = 0 end Click.ClickDetector.MouseClick:connect(onClick)