Finding player based on stringvalue not working? [SOLVED]
Asked by
5 years ago Edited 5 years ago
Hello!
So in my game I have a gui with parties that a player can click on to join, and then the party leader will have a gui pop up that asks if they either accept or decline the join request.
This is the code I have, that is fired from a remote even when the join button is clicked. It will put the pop up on the creator's screen.
01 | game.ReplicatedStorage.JoinRequestSend.OnServerEvent:Connect( function (player) |
02 | local guiButton = player.PlayerGui.FactionSelect.Main.PartiesList.Party.JoinParty |
03 | local creatorName = guiButton.Parent.PartyCreator.Value |
04 | local players = game:GetService( "Players" ) |
07 | for i, player in pairs (players:GetPlayers()) do |
08 | if player.Name = = creatorName then |
13 | local popup = game.ServerStorage.JoinReq:Clone() |
14 | popup.Parent = creator.PlayerGui |
Even though the PartyCreator value is the correct name of the player, when I try to find the creator's player based on that value, it gives me this error and the gui does not pop up:
11:03:09.797 - ServerScriptService.JoinRequestSendReciever:13: attempt to index local 'creator' (a nil value)
Sorry, the answer is probably obvious...
I will be extremely thankful if someone can help me figure out how to get this working...