Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can anyone spot an error in my closing door script?

Asked by
igric 29
7 years ago
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

Log in to vote
0
Answered by 7 years ago

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

0
Thanks :) igric 29 — 7y
Ad

Answer this question