I been scripting for HOURS trying to script a door. Basically when you click it, the door will open. If clicked again it will close. The issue is that I get no errors but the script does literally nothing. Any help will be appreciated.
Notes: 1. Door is anchored 2. Door is a union with parts like doorknobs inside 3. Door is placed where a negate part did cutting 4. CFramed was replaced with Position but did not work (I did not use Position.new though) 5. Vector3 is not an option.
function Universe() if script.Parent.Value.Value == false then script.Parent.Parent.Parent.MainDoor.CFrame = CFrame.new(-57.517, 4.067, 94.678) else script.Parent.Parent.Parent.MainDoor.CFrame = CFrame.new(-60.198, 4.067, 97.353) script.Parent.Value.Value = false end script.Parent.ClickDetector.MouseClick:Connect(Universe) end --true = open --false = closed
function Universe() if script.Parent.Value.Value == false then script.Parent.Parent.Parent.MainDoor.CFrame = CFrame.new(-57.517, 4.067, 94.678) else script.Parent.Parent.Parent.MainDoor.CFrame = CFrame.new(-60.198, 4.067, 97.353) script.Parent.Value.Value = false end end script.Parent.ClickDetector.MouseClick:Connect(Universe) --true = open --false = closed
Basically you were trying to fire the event inside the function, which won't work.
NitrousGalaxy, instead of doing the else stuff, you could use elseif like this
function Universe() if script.Parent.Value.Value == false then script.Parent.Parent.Parent.MainDoor.CFrame = CFrame.new(-57.517, 4.067, 94.678) elseif script.Parent.Value.Value == true then script.Parent.Parent.Parent.MainDoor.CFrame = CFrame.new(-60.198, 4.067, 97.353) script.Parent.Value.Value = false end end script.Parent.ClickDetector.MouseClick:Connect(function()
idk if it will work, because i didnt test it lol