Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Door script has no errors at all, but literally the script does nothing! Can someone help?

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

5 comments

0

can you like actually make these variables something that people can understand instead of script.Parent.Parent.Parent

0

Is it a local script or a normal script, and is experimental mode/filteringenabled on?

0

unanchor door and weld all

0

@Vulkarin People seem to understand just fine....

0

@AlphaGamer150 It is a regular script and filteringenabled is on. Filtering enabled does not seem to matter though because in studio I get the same result.

2 answers

✓ Accepted answer
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.

1 comment

0

Worked, thank you!

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

2 comments

0

I won't work because you aren't calling the function within the parameters.

0

I called the function within the parameters. but it still wont work. Forgot to mention in my question that the door is colliding with the foundation of my building.

This discussion is preserved as it was. New answers, comments, and votes are closed.