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

Displaying the name of the script's parent on a text label?


player = game.Players.LocalPlayer

script.Parent.MouseButton1Down:connect(function()
	game.Lighting.maps:Clone().Parent = player.PlayerGui
	wait(5)
	player.PlayerGui.maps:Remove()
end)

Everytime I try to game.Players.LocalPlayer.PlayerGui.map.Frame.TextLabel2 = "script.parent" the script breaks and nothing happens. Can anyone help with this?

1 comment

1

You need to set the text game.Players.LocalPlayer.PlayerGui.map.Frame.TextLabel2.Text = script.Parent.Name

1 answer

✓ Accepted answer

A better explanation or sending the whole script or a list of what the maps and map is would help people answer your questions, instead of sending part of a script without describing what each thing is.

player = game.Players.LocalPlayer -- This only works in local scripts btw
script.Parent.MouseButton1Down:connect(function() -- when they click on script.Parent
	maps = game.Lighting.maps:Clone() -- I like to make the clone seperately personally, and I would use Replicated Storage instead of Lighting but it is your choice.
	maps.Parent = player.PlayerGui -- puts the "maps" in the player's GUI
	player.PlayerGui.map.Frame.TextLabel2.Text = script.Parent.Name -- I'm assuming this is where you want it?? You need to set the Text equal to the name.
	wait(5)
	player.PlayerGui.maps:Remove() -- Removes

Remember to accept my answer if it is correct or comment to tell me how I could have done better to help answer your question!

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