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

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

Asked by 8 years ago

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
You need to set the text game.Players.LocalPlayer.PlayerGui.map.Frame.TextLabel2.Text = script.Parent.Name User#5423 17 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago

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!

Ad

Answer this question