Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 6 years ago

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

0
can you like actually make these variables something that people can understand instead of script.Parent.Parent.Parent Vulkarin 581 — 6y
0
Is it a local script or a normal script, and is experimental mode/filteringenabled on? AlphaGamer150 101 — 6y
0
unanchor door and weld all Lolamtic 63 — 6y
0
@Vulkarin People seem to understand just fine.... NitrousGalaxy 9 — 6y
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. NitrousGalaxy 9 — 6y

2 answers

Log in to vote
0
Answered by
NajeEod 35
6 years ago
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.

0
Worked, thank you! NitrousGalaxy 9 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

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

0
I won't work because you aren't calling the function within the parameters. NajeEod 35 — 6y
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. NitrousGalaxy 9 — 6y

Answer this question