1. oyuncu için değil, 2. oyuncu için sadece metin değişir

Aug 18 2020

Bu yüzden, 2 oyuncu oyundayken metni değiştirmek için bu komut dosyasını yazdım (bu normal bir senaryo), ancak sorun şu ki, oyuncu 2 oyuna daha sonra katıldığında metin yalnızca oyuncu 2'ye değişiyor ve oyuncu 1'e hiçbir şey olmuyor (ekledim metin etiketinin değişeceği metin etiketindeki komut dosyası) ve 1. oyuncu oyundan ayrıldığında metin değişmez. her zaman komut dosyası şu şekildedir:

if #game:GetService("Players"):GetPlayers() >= 2 then
script.Parent.Text ="Intermission: 25"
wait(1)
script.Parent.Text ="Intermission: 24"
wait(1)
script.Parent.Text ="Intermission: 23"
wait(1)
script.Parent.Text ="Intermission: 22"
wait(1)
script.Parent.Text ="Intermission: 21"
wait(1)
script.Parent.Text ="Intermission: 20"
wait(1)
script.Parent.Text ="Intermission: 19"
wait(1)
script.Parent.Text ="Intermission: 18"
wait(1)
script.Parent.Text ="Intermission: 17"
wait(1)
script.Parent.Text ="Intermission: 16"
wait(1)
script.Parent.Text ="Intermission: 15"
wait(1)
script.Parent.Text ="Intermission: 14"
wait(1)
script.Parent.Text ="Intermission: 13"
wait(1)
script.Parent.Text ="Intermission: 12"
wait(1)
script.Parent.Text ="Intermission: 11"
wait(1)
script.Parent.Text ="Intermission: 10"
wait(1)
script.Parent.Text ="Intermission: 9"
wait(1)
script.Parent.Text ="Intermission: 8"
wait(1)
script.Parent.Text ="Intermission: 7"
wait(1)
script.Parent.Text ="Intermission: 6"
wait(1)
script.Parent.Text ="Intermission: 5"
wait(1)
script.Parent.Text ="Intermission: 4"
wait(1)
script.Parent.Text ="Intermission: 3"
wait(1)
script.Parent.Text ="Intermission: 2"
wait(1)
script.Parent.Text ="Intermission: 1"
wait(1)
script.Parent.Text ="Intermission: 0"
else
script.Parent.Text ="Waiting for Players"
end

Yanıtlar

EliaGames Aug 29 2020 at 07:37

bu, hataları düzeltmelidir

local countdown = 25
local players = 0

game:GetService("Players").PlayerAdded:Connect(function()
    players = players + 1
end)

game:GetService("Players").PlayerRemoving:Connect(function()
    players = players - 1
end)

while wait(1) do
    if players > 1 then
        script.Parent.Text = "Intermission: ".. countdown
        print("Intermission: ".. countdown)
        countdown = countdown - 1
        if countdown <= 0 then
            script.Parent.Visible = false
            countdown = 25
        end
    end
    
    if players < 2 then
        script.Parent.Text = "Intermission: ".. countdown
        print("Intermission: ".. countdown)
        countdown = 25
    end
end