I'm trying to make it that when someone clicks a gui it adds them to a folder so then I can teleport them to the map and stuff. Everything in my script should work in the way I see it but I keep getting this error that I dont understand:
Players.epicnmac.PlayerGui.PartySystem.Frame.Frame.TextButton.LocalScript:4: attempt to index nil with 'Parent'
My code is in a starter gui and is a local script. This is my code:
local player = script.Parent.Parent.Parent.Parent.Parent.Parent.Name local char = player.Character function OnClicked() char.Parent = game.Workspace.PlayersMap end script.Parent.MouseButton1Down:connect(OnClicked)
Why does it give me an error? What do I have to do different to make it work?
Oh I managed to fix it after some troubleshooting I realized I was trying to find the character of the players name and not the player by deleting
.Name
I managed to fix it