Part won't move even if value is set to true

while true do
	wait(0.1)
	local Door = script.Parent
	local Status = script.Parent:FindFirstChild("DoorsOpen?").Value
	if Status == false then
		Door:PivotTo(CFrame.new(8.955, 7.85, 131.398))
	end
	if Status == true then
		Door:PivotTo(CFrame.new(12.655, 7.85, 131.398))
	end
end


When the value is set to true, the Door still does not move. No errors in output

Where are you setting Status to true? Is it in a LocalScript?

A normal script. Sorry for the long reply
I did Status.Value = true

friend I don’t know exactly the answer but the error is in:

Door:PivotTo(CFrame.new(8.955, 7.85, 131.398))

because I don’t know but what I do know is that the rest is fine
I’m going to check in my studio to see if my theory is correct and I’ll answer you in a few minutes

What I do know is that the error is in the status or in what I told you right now

while true do
	wait(0.1)
	local Door = script.Parent
	local Status = script.Parent:FindFirstChild("DoorsOpen?").Value
	if Status == false then
		Door:PivotTo(CFrame.new(8.955, 7.85, 131.398))
        Status = true
	end
	if Status == true then
		Door:PivotTo(CFrame.new(12.655, 7.85, 131.398)) 
        Status = false
	end
end

you need to debounce your variables

wont this just be a endless loop. because when the status is is false , then its set to true and then vice versa

Yes. This is because you have it in a while loop.

then wont the part just keep moving back and forth

Try this:

while true do
	wait(0.1)
	local Door = script.Parent
	local Status = script.Parent:FindFirstChild("DoorsOpen?").Value
	if Status == false then
		Door:PivotTo(CFrame.new(8.955, 7.85, 131.398))
        else
	    Door:PivotTo(CFrame.new(12.655, 7.85, 131.398))
        end
end

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