So I have tried for a while now to get the name of a player that presses a button to a textlabel but it won't work. I'm not entirely sure what I'm doing wrong.

script.Parent.MouseButton1Down:connect(function()
	local TextLabel = script.Parent.Parent.TextLabel
	TextLabel.Text = game.Players.LocalPlayer.Name
end)

4 comments

0

Is this a localscript?

0

Yes it is!

0

Theres nothing wrong with this script. Make sure that its actually being run, like a print at the beginning, and if not look around to see why its not

0

Also make sure your paths to the ui are correct