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

Open door button script not working. Any help? (This button is for a rank+ only.)

local ClickDetector = script.Parent.ClickDetector
open = false
LGate2 = script.Parent.LGate2
RGate2 = script.Parent.RGate2
Increment = 180

ClickDetector.MouseClick:Connect(function (player)
    if player:GetRankInGroup(4853203) >= 10 then
        script.Parent.ClickDetector.MouseClick:Connect(function()
	if open == false then
		open = true
		for C = 1, Increment do
			wait()								
			LGate2.PrimaryPart = LGate2.hinge
			RGate2.PrimaryPart = RGate2.hinge							
			LGate2:SetPrimaryPartCFrame(LGate2.PrimaryPart.CFrame * CFrame.fromEulerAnglesXYZ(0,math.rad(-110/Increment),0))
			RGate2:SetPrimaryPartCFrame(RGate2.PrimaryPart.CFrame * CFrame.fromEulerAnglesXYZ(0,math.rad(110/Increment),0))
		end
	elseif open == true then
		open = false
		for C = 1, Increment do
			wait()								
			LGate2.PrimaryPart = LGate2.hinge
			RGate2.PrimaryPart = RGate2.hinge								
			LGate2:SetPrimaryPartCFrame(LGate2.PrimaryPart.CFrame * CFrame.fromEulerAnglesXYZ(0,math.rad(110/Increment),0))
			RGate2:SetPrimaryPartCFrame(RGate2.PrimaryPart.CFrame * CFrame.fromEulerAnglesXYZ(0,math.rad(-110/Increment),0))
		end
	end
end)
    end
end)

My script to open a door isn't working. This is where everything is located: https://prnt.sc/r9rgvp

There are two doors with 1 script each. I have a left and a right door.

2 answers

✓ Accepted answer

#Problems On line 3 and 4 you said script.Parent.LGate2 and script.Parent.RGate2 and script.Parent is RemotePadInterview and RemotePadTraining #Solution Replace script.Parent with script.Parent.Parent #Final Script Snippet

local ClickDetector = script.Parent.ClickDetector
open = false
LGate2 = script.Parent.Parent.LGate2
RGate2 = script.Parent.Parent.RGate2
Increment = 180

-- Other code here...

3 comments

0

Thanks so much! I did this to both scripts but... the interview door isn't working.

0

Nevermind, you just have to double click the button and it opens. Thanks for the help!

0

No Problem :D

I think that line 9 is stoping it from working. Remove line 9 and the end for it and try again

1 comment

0

It's saying something about line 3. I did just delete line 9 though.

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