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)
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)