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

Why Isn't My Hint Bar Script Working? Why isn't it?

Note: I am a beginner scripter, so I might have problems! The script I use:

function onPlayerEntered(newPlayer)
wait(5)
local Msg = Instance.new ("Hint")
Msg.Parent = game.Workspace
Msg.Text = "Welcome to my game "..player.Name.."! Thanks!"
wait(5)
end

game.Workspace.Players.PlayerAdded:connect(onPlayerEntered)

I really need help on this one! I seem to find nothing wrong with it.

2 comments

1

No one seems to have mentioned your connection line. It is game.Players.PlayerAdded not game.Workspace.Players.PlayerAdded.

0

Oh....... Okay, weird no one has said anything about it.

2 answers

✓ Accepted answer
game.Players.PlayerAdded:connect(function(plr)
	local msg = Instance.new("Hint", game.Workspace)
	msg.Text = "Welcome to my game "..plr.Name.."! Thanks!"
	wait(3);
	msg:Destroy();
end)

You didn't define the player correctly and the wait(0) is pointless.

A friend suggested you don't use this though (which I agree with) since hints are outdated. Using a GUI and TextLabels is probably better.

3 comments

0

I know wait(0) is pointless, I just added that for no reason, anyways, isn't it: newPlayer.Name? Oh and do I have to put the destroy thing?

0

I changed your newPlayer to plr (just out of my old habits) and the :Destroy would be good considering you don't want a permanent hint.

0

Oh! I thought the hint would go away by itself! Thanks!

Line 5: its not player, its newPlayer

function onPlayerEntered(newPlayer)
wait(0)
local Msg = Instance.new ("Hint")
Msg.Parent = game.Workspace
Msg.Text = "Welcome to my game "..newPlayer.Name.."! Thanks!"
wait(5)
end

1 comment

0

Thanks!

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