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

Why do I get this error from this script?

game.Players.PlayerAdded:connect(function(player)
	
game.StarterGui.level.Frame.PlayerFrame.PlayerImage.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username="..player.Name
game.StarterGui.level.Frame.Name.Text = tostring(player.Name)
game.StarterGui.level.Frame.Level.Text = ("Level "..game.Workspace.Utilities.Plugins["Bloxcade Center"].Level.Value)

end)

I get this error "Workspace.Utilities.Gui Utilities.ExperienceSystem:4: attempt to index field 'Name' (a string value)" from line 4, why? Thanks.

2 answers

✓ Accepted answer

You're getting this error because Name is a Property of Frame as well as a Child of Frame. The two cannot co-exist successfully. I would just change the name of Name to something like PlrName, and it should work perfectly.

1 comment

0

Ohhhhhhhhhhhhhh.....thank you so much

You that error because Text is not a member of Name. To find (or change) then name of something you would simply just do

Example.Name = "NewName"

And in your case:

game.Players.PlayerAdded:connect(function(player)

game.StarterGui.level.Frame.PlayerFrame.PlayerImage.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username="..player.Name
game.StarterGui.level.Frame.Name= player.Name -- Also you dont need tostring() here
game.StarterGui.level.Frame.Level.Text = ("Level "..game.Workspace.Utilities.Plugins["Bloxcade Center"].Level.Value)

end)


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