EngediKimHyeYoung / Roblox

0 stars 0 forks source link

스위치 2개를 작동하고 투명다리 건너기 #18

Open EngediKimHyeYoung opened 3 years ago

EngediKimHyeYoung commented 3 years ago

local switchStair = script.Parent

local onColor = Color3.fromRGB(0, 255, 0) local offColor = Color3.fromRGB(255, 0, 0)

switchStair.Color = offColor

local stair1 = game.Workspace.Stair.Stair1 local stair2 = game.Workspace.Stair.Stair2 local stair3 = game.Workspace.Stair.Stair3 local stair4 = game.Workspace.Stair.Stair4 local stair5 = game.Workspace.Stair.Stair5 local stair6 = game.Workspace.Stair.Stair6 local stair7 = game.Workspace.Stair.Stair7

local stairArray = {stair1, stair2, stair3, stair4, stair5, stair6, stair7}

local function showStair() for i=1, #stairArray do switchStair.Color = onColor stairArray[i].Color = onColor stairArray[i].CanCollide = true stairArray[i].Transparency = 0 wait(1) end

wait(3)

for i=#stairArray, 1, -1 do
    stairArray[i].Color = offColor
    stairArray[i].CanCollide = false
    stairArray[i].Transparency = 0.8
    wait(2)
end

switchStair.Color = offColor

end

for i=1, #stairArray do stairArray[i].Color = offColor end

switchStair.Touched:Connect(showStair)