Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Text doesn't change though there are no errors in the output nor in the game console?

Asked by 4 years ago
Edited 4 years ago

I may have issues with scripts these times but I can not understand what's causing it. Anyways I have a problem with this script:

local infoLabel = game.StarterGui.ScreenGui.infoLabel

game.Players.PlayerAdded:Connect(function(player)
    game.StarterPlayer.CharacterWalkSpeed = 0

    infoLabel.Text = "Welcome to Player Experiments."

    wait(5)

    infoLabel.Text = "Lets start with your username."

    wait(5)

    infoLabel.Text = "Your username is ".. player.Name.. ". Right?"
end)

It had to change the infoLabel's text to "Lets start with your username" but instead it stayed at "Welcome to Player Experiments". It also doesn't go to "Your username is ".. player.Name.. ". Right?". I can't understand what is wrong here as there are no errors.

0
I added the PlayerAdded event because I wanted to see if it works like that but unfortunately it doesn't ;( DangerousKillerTimur 54 — 4y
0
Is it a local script? marine5575 359 — 4y

1 answer

Log in to vote
1
Answered by
SnowieDev 171
4 years ago
Edited 4 years ago

This will happen everytime the player respawns, they'll start from the beginning if they die.

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(Character)
        Character.Humanoid.WalkSpeed = 0
        local PlayerGui = player:WaitForChild("PlayerGui")
        local ScreenGui = PlayerGui:WaitForChild("ScreenGui")
        local infoLabel = ScreenGui:WaitForChild("infoLabel")
        infoLabel.Text = "Welcome to Player Experiments."
        wait(5)
        infoLabel.Text = "Lets start with your username."
        wait(5)
        infoLabel.Text = "Your username is ".. player.Name.. ". Right?"
    end)
end)

If you didn't want that then here, it'll only play the beginning part once:

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Wait()
    player.Character.Humanoid.WalkSpeed = 0
    local PlayerGui = player:WaitForChild("PlayerGui")
    local ScreenGui = PlayerGui:WaitForChild("ScreenGui")
    local infoLabel = ScreenGui:WaitForChild("infoLabel")
    infoLabel.Text = "Welcome to Player Experiments."
    wait(5)
    infoLabel.Text = "Lets start with your username."
    wait(5)
    infoLabel.Text = "Your username is ".. player.Name.. ". Right?"
end)
Ad

Answer this question