I am having a issue with my door opening script

I am trying to make a script that when you click E on the part will move to the right. I had it working at one point but the more I messed around with it then it broke. What do I have to do to get it working again? Shouldn’t be too hard but I tried a lot of things to fix it and I can’t see to get it working

local parent = script.Parent.Parent
local child = script.Parent
local door = game.Workspace.RE

local function onTriggered(player)
	child.Enabled = false
	for i = 1, 7 do
		door.CFrame = door.CFrame - Vector3.new(1, 0, 0)
		wait(0.1)
	end
	wait(4)
	for i = 1, 7 do
		door.CFrame = door.CFrame + Vector3.new(1, 0, 0)
		wait(0.1)
	end
	child.Enabled = true
end

child.Triggered:Connect(onTriggered)

can you take a video of whats not working?

The door has a proximityPrompt in it so when I click E the door should open and when I click E again the door should close

yea, but whats not working with it, can you take a screenshot of the problem or are there any errors?

One error is "Triggered is not a valid member of Part “Workspace.RE”

The issue is that when I click E the door does not open

can you send a screenshot of your hagiarchy?

Change the child variable to what is shown in this script

local parent = script.Parent.Parent
local child = script.Parent.ProximityPrompt
local door = game.Workspace.RE

local function onTriggered(player)
	child.Enabled = false
	for i = 1, 7 do
		door.CFrame = door.CFrame - Vector3.new(1, 0, 0)
		wait(0.1)
	end
	wait(4)
	for i = 1, 7 do
		door.CFrame = door.CFrame + Vector3.new(1, 0, 0)
		wait(0.1)
	end
	child.Enabled = true
end

child.Triggered:Connect(onTriggered)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.