Я создавал обби в Roblox, и я хотел сделать кнопку, на которую игрок мог бы наступить, чтобы платформы перед ними были прочными. Я проверил документацию и не нашел ничего, что могло бы помочь. Вот мой код: (Игнорируйте e, ee, eee, bt, bt1, bt2 и tch. Это мои части / переменные / имена функций)
bt = game.Workspace.e.SurfaceGui.ButtonTimer
bt1 = game.Workspace.ee.SurfaceGui.ButtonTimer1
bt2 = game.Workspace.eee.SurfaceGui.ButtonTimer2
bt.Text = "hi "
bt1.Text = "hi "
bt2.Text = "hi "
script.Parent.Touched:Connect(function(tch)
if tch.Parent:FindFirstChild("Humanoid") then
game.Workspace.e.Transparency = 0
game.Workspace.e.CanCollide = true
game.Workspace.ee.Transparency = 0
game.Workspace.ee.CanCollide = true
game.Workspace.eee.Transparency = 0
game.Workspace.eee.CanCollide = true
bt.Text = "10"
bt1.Text = "10"
bt2.Text = "10"
wait(1)
bt.Text = "9"
bt1.Text = "9"
bt2.Text = "9"
wait(1)
bt.Text = "8"
bt1.Text = "8"
bt2.Text = "8"
wait(1)
bt.Text = "7"
bt1.Text = "7"
bt2.Text = "7"
wait(1)
bt.Text = "6"
bt1.Text = "6"
bt2.Text = "6"
wait(1)
bt.Text = "5"
bt1.Text = "5"
bt2.Text = "5"
wait(1)
bt.Text = "4"
bt1.Text = "4"
bt2.Text = "4"
wait(1)
bt.Text = "3"
bt1.Text = "3"
bt2.Text = "3"
wait(1)
bt.Text = "2"
bt1.Text = "2"
bt2.Text = "2"
wait(1)
bt.Text = "1"
bt1.Text = "1"
bt2.Text = "1"
wait(1)
bt.Text = "0"
bt1.Text = "0"
bt2.Text = "0"
game.Workspace.e.Transparency = 0.75
game.Workspace.e.CanCollide = false
game.Workspace.ee.Transparency = 0.75
game.Workspace.ee.CanCollide = false
game.Workspace.eee.Transparency = 0.75
game.Workspace.eee.CanCollide = false
else
game.Workspace.e.BrickColor = BrickColor.Red()
end
end)
wait()
, которую вы уже используете, возвращает текущий поток, поэтому это один из способов заставить работать функцию, подобную таймеру. - person Kylaaa   schedule 27.11.2020