Doors notnworking

I’m helping my kid with the game he is building and we are both new to this. He used a few models (sliding door and buttons with a cover) that worked when he added them. All of a sudden they stopped working after the program froze. So we went back a few saves until everything was working again.

He worked on creating his building for a while when he realized that the doors and button covers will not open. He didn’t touch the scripts in the door. The door makes the open and close sound but doesn’t move. It’s the same with the buttons. It’s all of the doors and buttons with covers. Other parts of the scripts work but nothing is moving even new models.

Is there a setting we could have accidentally changed that would make this happen? Any other ideas about what is going on?

Thanks!

1 Like

Try on of this :

  • look for error in the script with a print(“work”) just before the tweening

  • Check if they are not part coliding with the doo or if the door is anchored

  • Make sure they are in the correct hierachy use by the script

1 Like

Can you post the script’s code snippet here? That way we can determine the issue.

This is the code for the doors.

local tweenService = game:GetService("TweenService")

local doorModel = script.Parent
local door1 = doorModel:WaitForChild("Door1")
local door2 = doorModel:WaitForChild("Door2")
local goal1 = doorModel:WaitForChild("Goal1")
local goal2 = doorModel:WaitForChild("Goal2")

local trigger = doorModel:WaitForChild("Trigger")

local origCFrame1 = door1.PrimaryPart.CFrame
local origCFrame2 = door2.PrimaryPart.CFrame

--CONFIG VARIABLES
local tweenTime = 0.5
local closeWaitTime = 3
local easingStyle = Enum.EasingStyle.Quad
local easingDirection = Enum.EasingDirection.InOut
local repeats = 0
local reverse = false
local delayTime = 0
--yep

local deb = false
local info = TweenInfo.new(tweenTime, easingStyle, easingDirection, repeats, reverse, delayTime)
local function tweenModel(model, CF)
	local CFrameValue = Instance.new("CFrameValue")
	CFrameValue.Value = model:GetPrimaryPartCFrame()

	CFrameValue:GetPropertyChangedSignal("Value"):Connect(function()
		model:SetPrimaryPartCFrame(CFrameValue.Value)
	end)
	
	local tween = tweenService:Create(CFrameValue, info, {Value = CF})
	tween:Play()
	
	tween.Completed:Connect(function()
		CFrameValue:Destroy()
	end)
end

local function onTouched(hit)
	if hit.Parent then
		local char = hit.Parent
		local hum = char:FindFirstChild("Humanoid")
		if hum then
			if deb == false then
				deb = true
				script.Parent.Trigger.Sound:Play()
				tweenModel(door1, goal1.CFrame)
				tweenModel(door2, goal2.CFrame)
				
				wait(3)
				script.Parent.Trigger.Sound:Play()
				tweenModel(door1, origCFrame1)
				tweenModel(door2, origCFrame2)
				
				wait(1)
				
				deb = false
			end
		end
	end
end

trigger.Touched:Connect(onTouched)

This is the code for the button with a cover.

local Tween = game:GetService("TweenService")
local Open = false
function Change()
	if script.Parent.Lock1.Value and script.Parent.ButtonLocked.Value==false then
		if not Open then
			Tween:Create(script.Parent.Rotate,TweenInfo.new(0.5,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out),{CFrame=script.Parent.Rotate.On.CFrame}):Play()
			Open=true
			script.Parent.Cover.Door:Play()
		end
	else
		if Open then
			Tween:Create(script.Parent.Rotate,TweenInfo.new(0.7,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{CFrame=script.Parent.Rotate.Off.CFrame}):Play()
			Open=false
			script.Parent.Cover.Door:Play()
		end
	end
end
script.Parent.Lock1.Changed:Connect(Change)
script.Parent.ButtonLocked.Changed:Connect(Change)

script.Parent.Button.ClickDetector.MouseClick:Connect(function()
	if script.Parent.ButtonLocked.Value==false and Open then
		local t = Tween:Create(script.Parent.Button,TweenInfo.new(0.15,Enum.EasingStyle.Sine,Enum.EasingDirection.Out),{CFrame=script.Parent.Button.On.CFrame})
		t:Play()
		script.Parent.Button.Down:Play()
		t.Completed:wait()
		script.Parent.ButtonLocked.Value=true
		local t = Tween:Create(script.Parent.Button,TweenInfo.new(0.15,Enum.EasingStyle.Sine,Enum.EasingDirection.In),{CFrame=script.Parent.Button.Off.CFrame})
		t:Play()
	end
end)

He recorded what is currently happening. The explosion sounds are when the doors or button cover are supposed to open but don’t.