Untuk SD Sesi 4

https://forms.gle/2R63M4HBJJeyJNFy7


Untuk SMP Game Innov

https://forms.gle/PuSRWTwc2RJUqi319


SCRIPT SURPRISE DOOR

local walls = script.Parent:GetChildren()

local closedWalls = {}

local correctWall = nil


-- copy walls into closed list

for _, w in pairs(walls) do

if w:IsA("BasePart") then

table.insert(closedWalls, w)

end

end


local function pickNewWall()

if #closedWalls == 0 then

print("All walls are open!")

return

end


correctWall = closedWalls[math.random(1, #closedWalls)]

print("Correct wall:", correctWall.Name)

end


pickNewWall()


for _, wall in pairs(walls) do

if wall:IsA("BasePart") then

wall.Touched:Connect(function(hit)

local humanoid = hit.Parent:FindFirstChild("Humanoid")

if not humanoid or not correctWall then return end


if wall == correctWall then

-- open permanently

wall.CanCollide = false

wall.Transparency = 0.6


-- remove from closed list

for i, w in pairs(closedWalls) do

if w == wall then

table.remove(closedWalls, i)

break

end

end


task.wait(1)

pickNewWall() -- choose next correct wall

else

-- wrong wall feedback

wall.BrickColor = BrickColor.new("Really red")

task.wait(0.2)

wall.BrickColor = BrickColor.new("Medium stone grey")

end

end)

end

end


Komentar

Postingan populer dari blog ini

Materi Roblox Permainan Harvest

Script Roblox Studio (Character Free Falling)

Script Roblox Studio Kill Player, Lava Floor, Neon