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

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

Asked by 10 years ago

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.

1
No one seems to have mentioned your connection line. It is game.Players.PlayerAdded not game.Workspace.Players.PlayerAdded. Aethex 256 — 10y
0
Oh....... Okay, weird no one has said anything about it. Operation_Meme 890 — 10y

2 answers

Log in to vote
1
Answered by 10 years ago
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.

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? Operation_Meme 890 — 10y
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. PiggyJingles 358 — 10y
0
Oh! I thought the hint would go away by itself! Thanks! Operation_Meme 890 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

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

0
Thanks! Operation_Meme 890 — 10y

Answer this question