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

having problem with string value to specify a player name , how to fix?

so im making an house system and now im making a test , i know how to substract money but i have a problem; this is a test so it's free XD

script.Parent.ClickDetector.MouseClick:Connect(function(player)
	local name = script.Parent.teSTO.name
	local textlabel = script.Parent.teSTO.SurfaceGui.TextLabel
		name.Value = player
		textlabel.Text = name
end)

--name is a string value--

Workspace.test.Script:4: invalid argument #3 (string expected, got Instance)  -  Server  -  Script:4

can u help me thx

1 answer

✓ Accepted answer

On line 4, you're giving the player instance, the player object in the Players service.

To get the player's name u must do this:

name.Value = player.Name

4 comments

0

oh yes i forgot , that was a stupid question XD, but now i get Workspace.test.Script:5: invalid argument #3 (string expected, got Instance)

0

wait i think i fixed it

0

U need to write "name.Value" to make it work

0

thx

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