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

My player.name isnt working even thought I've tried many ways. pls someone help?

Asked by 6 years ago

local m = Instance.new("Hint")

script.Parent.MouseButton1Down:connect(function(OnClicked) m.Parent = game.Workspace m.Text = "Has an order!" wait(10) m.Parent = nil

script.Parent.MouseButton1Down:connect(OnClicked) end)

So I tried to use player.Name.. before "Has an order!" and it didnt work.. Can someone make it so it makes it say the local players name and then after it "Has an order!"?

So something like "Gamerbeeze1 has an order!" but it will work with any username, please and thanks.

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

I don't see anything in your script that has to do with player names. If you just put "player.Name" before "Has an order", it won't work because you didn't even put anything that specifies the player.

Here's the problems with your script :

local m = Instance.new("Hint") --If you want this to show up every time the player clicks the button, put it in the function

script.Parent.MouseButton1Down:connect(function(OnClicked) 
m.Parent = game.Workspace 
m.Text = "Has an order!" --All you did is put "Has an order!". There's nothing about player names here. 
wait(10) 
m.Parent = nil

script.Parent.MouseButton1Down:connect(OnClicked) end) --This line of code isn't neccesary

Here's how I did it :

script.Parent.MouseButton1Down:connect(function() 
    local m = Instance.new('Hint') --Creates new hint
    m.Parent = game.Workspace --Parents it to workspace
    m.Text = game.Players.LocalPlayer.Name.." has an order!" --Puts the localplayer name before the text.
    wait(10)
    m:Destroy() --Removes the hint.
end)

Also just a note. Hints can still be used but they're deprecated, so I don't recommend you use this all the time.

Here's a link about hints if you want to know more about it :

http://wiki.roblox.com/index.php?title=API:Class/Hint

0
Your link didnt work.. but thanks for the script gamerbeeze1 -3 — 6y
0
Sorry. I posted the link the wrong way so it leads you to a blank page. It should be fixed now. User#20279 0 — 6y
Ad

Answer this question