In-Game Party System : Player and/or Player.Name is returning nil

Hello, I’ve been attempting to make little system in my that invites a player to their “Party.”
The main issue is actually firing the player’s name or player instance to the Server. Here’s a little something, both Arguments are used as Player Instances.

You are welcome to reply and tell me issues I have on my scripts.

I’ve tried printing and troubleshooting but I can’t seem to find the issue.
I’ve tried converting a Player Instance and Name into a string and still returned nil.
I tried to find other topics like this but couldn’t seem to find one that is understandable and helpful

I’ve tried to use :Fire"Client or Server" and having both arguements as player instances and it worked. If I have to change anything, then you could tell me my issues

I’m only going to show PARTS of my script and they are mainly where the issue occurs, If you need the full script then you could ask me

Server Script (Inside a Folder IN ServerScriptService) Partial Lines 1-10

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local function replicateInvite(plr2, plr)
	local player = Players:FindFirstChild(plr)
	print(player)
		if player then
			print(plr.Name.." Testing 1")
			print(player.Name.." Testing 2")
			local GUI = plr.PlayerGui.Level	

Local Script (Inside a ScreenGui) Partial Lines 33-50

		if Players.LocalPlayer.Name == plr.Name then
			newButton.Visible = false
		end
		
		newButton.Activated:Connect(function()
			if debounce == true  then
				debounce = false
				
				local plyName = tostring(plr)

				
				
			ReplicatedStorage.PartySystem.SendInvite:FireServer(game.Players.LocalPlayer, plr.Name)
			script.Invite:Play()
			newButton:FindFirstChild("Invited").Visible = true
			wait(1.25)
			print("Sent invite To "..plr.Name)
			refresh()

Any help is appreciated. I’m still learning on how to script so I don’t understand some of what I’m using

Just so you understand what I’m trying to do, I’m trying to make the Local Script send a Event from the LocalScript to the ServerScript so a GUI appears on that screen.

1 Like

You don’t need to define the localplayer in a FireServer since it’s already given in the OnServerEvent

Just do this:

ReplicatedStorage.PartySystem.SendInvite:FireServer(plr.Name)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.