Remote event isn't passing on information correctly

Got a local script that all works fine, triggers a remote event that contains a players name and the name of the parent of the local script that a server script picks up and is meant to use, the only issue though is that the local scripts parent isn’t even transferred along, on the server script, if I get it to print out the players name and “NewTeam” (the local scripts script.parent), it just prints the players name again in place of what “NewTeam” should be saying.

Local script:

local player = game.Players.LocalPlayer
local box = script.Parent
local Count = box:WaitForChild("Value")
local Menu = script.parent.parent
local TeamFull = Menu:WaitForChild("Team is full")
local Teams = game:GetService("Teams")
local PJT = game.ReplicatedStorage:WaitForChild("PlayerJoinTeam")
local NewTeam = script.Parent

if Count.Value == 0 then
	box.Visible = false
end

box.MouseEnter:Connect(function()
	box.ImageColor3 = Color3.new(255, 255, 255)

end)

box.MouseLeave:Connect(function()
	box.ImageColor3 = Color3.new(0.72549, 0.72549, 0.72549)

end)


box.MouseButton1Click:Connect(function()

	if player.Team.Name == "Hunters" then
		if player.Team.Name ~= box.Name then

			if Count.Value < 3 then
				PJT:FireServer(player, NewTeam)
			else 
				TeamFull.Visible = true
				wait(3)
				TeamFull.Visible = false
			end
		end
	end
end)

Server script:

local function JoinTeam(player, NewTeam) -- Join team
	print(player.Name .. " has joined " .. NewTeam.Name)
	
end

PJT.OnServerEvent:Connect(JoinTeam)

player is already automatically added

use PJT:FireServer(NewTeam)

right now you are getting (player, player, NewTeam) and then naming it to (player, NewTeam)
so when you do NewTeam.Name you are actually getting player.Name

1 Like

Ohhh okay, always thought I had to put ‘player’ in as well, thanks!

Remote Functions and Events (roblox.com)