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

Can anyone spot an error in my closing door script?

local door = game.Workspace.SlideDoor
local position = door.Position
Y =  223.2

function closing()
	while Y >= 207.75 do
		wait(0.01)
		Y = Y - 0.05
		position = CFrame.new(position.X,Y,position.Z)
		print(Y)
	end
end

script.Parent.ClickDetector.MouseClick:connect(closing)

I want the door to go down but it looks like something is wrong. Door wont move, but in the output i get correct number Y.

1 answer

✓ Accepted answer

local door = game.Workspace.SlideDoor
local position = door.Position
Y =  223.2
function closing()
    while Y >= 207.75 do
        wait(0.01)
        Y = Y - 0.05
        door.CFrame = CFrame.new(position.X,Y,position.Z)
        print(Y)
    end
end
 
script.Parent.ClickDetector.MouseClick:connect(closing)

i replaced a positon value with door.CFrame

1 comment

0

Thanks :)

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