Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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.

2 comments

0

I added the PlayerAdded event because I wanted to see if it works like that but unfortunately it doesn't ;(

0

Is it a local script?

1 answer

✓ Accepted answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.