mardi 10 mars 2020

Roblox Studio Lua if function in loop

I have a Roblox Game in this game the time changes using the code on the Roblox Developer site(robloxdev.com) I have been making a door with two unions called "open" and "closed". I want the door to be open between 10 in the morning and 5 in the evening.

This is my current code Note: The script is in the same model(called:Door) as the two unions.

while true do
    if game.Lighting.ClockTime > 10 and game.Lighting.ClockTime < 17 then
        --Open the door
        print("open")
        script.Parent.Closed.Transparency = 1
        script.Parent.Closed.CanCollide = false

        script.Parent.Open.Transparency = 0
        script.Parent.Open.CanCollide = true
    else
        --Close the door
        print("close")
        script.Parent.Closed.Transparency = 0
        script.Parent.Closed.CanCollide = true

        script.Parent.Open.Transparency = 1
        script.Parent.Open.CanCollide = false
    end
end

Thank's for any help.

Aucun commentaire:

Enregistrer un commentaire