Why isn't my remote event firing?

I’m trying to make a remoteevent fire after a player has joined the “management” team, to then display it on my custom leaderboard, but for some reason the remote event isn’t firing… I’ve tried numerous prints and tried debugging it myself, but to no avail.
localscript

local plr = game.Players.LocalPlayer
local Teams = game:GetService("Teams")
local replicatedStorage = game:GetService("ReplicatedStorage")
local ManagementEvent = replicatedStorage.ManagementTeam
wait(1)

local teamCheck = plr.Team

if teamCheck.Changed == Teams.Management then
	ManagementEvent:FireServer("test", teamCheck)
end

Serverscript

NewSlot.Parent = script.Parent.LeaderboardFrame.HoldingFrame
		managementEvent.OnServerEvent:Connect(function(player, teamCheck)
			print(teamCheck)
5 Likes

This is not how events work


plr:GetPropertyChangedSignal("Team"):Connect(function() -- connect to the 'Team' property of the player to check when it's modified
    if plr.Team == Teams.Management then -- check the tean
        ManagementEvent:FireServer("test", teamCheck) -- fire to the server
    end
end)
3 Likes

i’m not able to print the teamCheck through the serverside, am i doing something wrong, or is it impossible to do through my current methods?

2 Likes
NewSlot.Parent = script.Parent.LeaderboardFrame.HoldingFrame
		managementEvent.OnServerEvent:Connect(function(player, testString, teamCheck)
			print(teamCheck) -- prints the team Instance (assuming it also exists on the server)

testString is the string that you sent through first:

ManagementEvent:FireServer("test", teamCheck)

The order of RemoteEvents (server) is: (<Player>, …args); the player will always be the first parameter when you use OnServerEvent, followed by whatever you sent through the remote

2 Likes

surely, once they’ve all been listed I should be able to print teamCheck, but I am still unable to do this. Is there something I must change within the server script in order to achieve the results I’m looking for? Since I wish to pass the team info from my localscript to the serverscript, but so far I’m not able to
image

image

Try removing the wait(1) from your script; if the team is being assigned before the connection is created, it won’t detect anything

I’ve removed the wait(1) from my local script, but teamCheck is not printing…
image

The reason for this is because the player team is not being changed. So the Plr:GetPropertChangedSignal Function isn’t firing try assigning the player to the team then it should fire
Example

local plr = game.Players.LocalPlayer
local Teams = game:GetService("Teams")
local replicatedStorage = game:GetService("ReplicatedStorage")
local ManagementEvent = replicatedStorage.ManagementTeam
local teamCheck = plr.Team
print(plr.Team)


plr:GetPropertyChangedSignal("Team"):Connect(function()
	if plr.Team == Teams.Management then
		ManagementEvent:FireServer(plr,"test", teamCheck)
	end	
end)

wait(5)
plr.Team = Teams.Management

there is a team changer GUI already within, so the team is getting changed, however, despite this, the teamCheck is not printing on the server side. It only prints on the client side
image

here’s the team changer GUI

Can i please see the team changer GUI script?

i got it to print, but it’s not printing the right team for some reason. Here’s the new script.
image
and here’s the print
image

this only prints when i click the purple icon, which is management. how would I go about printing the team I got changed into, and not the team I was on previously?

i’ve tried adding a wait to the script, yet it makes it just not work anymore

Could we see a full version of what Script you have on the server and client regarding this issue? It’s a bit confusing having the Scripts being modifying bit by bit.

Alrighty!

Serverscript

--Custom Leaderboard Script. Made by Leaderboard+ plugin (by Infinite_Visions).
--Find the plugin Documentation here: https://devforum.roblox.com/t/leaderboard-create-custom-leaderboards-in-studio/1338477

local Settings = script.Parent.Settings
local Path = nil
local Teams = game:GetService("Teams")
local replicatedStorage = game:GetService("ReplicatedStorage")
local managementEvent = replicatedStorage.ManagementTeam

--Handle Admins. If You Have no admins, ignore this.
local Admins = {
	"Infinite_Visions",
	"Example_Name_Here"
}

--Get Creator Id
local ownerId = nil
if game.CreatorType == Enum.CreatorType.Group then
	local PlaceInfo = game:GetService("MarketplaceService"):GetProductInfo(game.PlaceId)
	ownerId = game:GetService("GroupService"):GetGroupInfoAsync(PlaceInfo.Creator.CreatorTargetId).Owner.Id
else
	ownerId = game.CreatorId
end

--Setup Players Already In-Game
for i, player in pairs(game.Players:GetChildren()) do
	--Add a slot to the leaderboard
	local NewSlot = script.Parent.LeaderboardFrame.HoldingFrame.Sample:Clone()
	NewSlot.Name = player.Name
	
	--Handle Names
	local NameText = nil
	
	if Settings.DisplayNames.Value == true then
		NameText = player.DisplayName
	else
		NameText = player.Name
	end
	
	if Settings.UpperCase.Value == true then
		NewSlot.PlrName.Text = string.upper(NameText)
	else
		NewSlot.PlrName.Text = NameText
	end
	
	--Handle Icons
	if player.UserId == ownerId and Settings.ShowOwner.Value == true then
		NewSlot.Owner.Visible = true
	else
		if Settings.ShowAdmin.Value == true then
			for i = 1, #Admins do
				if player.Name == Admins[i] then
					NewSlot.Admin.Visible = true
				end
			end
		elseif game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,13376596) and Settings.CustomGamepass.Value == true then	
			NewSlot.GamepassSymbol.Visible = true
		elseif player.MembershipType == Enum.MembershipType.Premium and Settings.ShowPremium.Value == true then
			NewSlot.Premium.Visible = true
		end
	end
	
	--If CustomData, Handle DataChanges
	if Settings.CustomData.Value == true then
		Path = script.Parent.Settings.CustomData		
		Path.Changed:Connect(function()
			NewSlot.Currency1.Text = Path.Value
		end)
	end
	NewSlot.Visible = true
	--The Path to the Values you want displayed, if any.
	NewSlot.Parent = script.Parent.LeaderboardFrame.HoldingFrame
end

game.Players.PlayerAdded:Connect(function(player)
	--Add a slot to the leaderboard
	local NewSlot = script.Parent.LeaderboardFrame.HoldingFrame.Sample:Clone()
	NewSlot.Name = player.Name
	
	--Handle Names
	local NameText = nil
	
	if Settings.DisplayNames.Value == true then
		NameText = player.DisplayName
	else
		NameText = player.Name
	end
	
	if Settings.UpperCase.Value == true then
		NewSlot.PlrName.Text = string.upper(NameText)
	else
		NewSlot.PlrName.Text = NameText
	end
	
	--Handle Icons
	if player.UserId == ownerId and Settings.ShowOwner.Value == true then
		NewSlot.Owner.Visible = true
	else
		if Settings.ShowAdmin.Value == true then
			for i = 1, #Admins do
				if player.Name == Admins[i] then
					NewSlot.Admin.Visible = true
				end
			end
		elseif game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,13376596) and Settings.CustomGamepass.Value == true then	
			NewSlot.GamepassSymbol.Visible = true
		elseif player.MembershipType == Enum.MembershipType.Premium and Settings.ShowPremium.Value == true then
			NewSlot.Premium.Visible = true
		end
	end
	
	--If CustomData, Handle DataChanges
	if Settings.CustomData.Value == true then
		Path = script.Parent.Settings.CustomData		
		Path.Changed:Connect(function()
			NewSlot.Currency1.Text = Path.Value
		end)
	end
	NewSlot.Visible = true
	
	local function test(arg1, arg2)
		print("testing", arg1, arg2)
	end
		end)

managementEvent.OnServerEvent:Connect(function(player, teststring, teamCheck)
	if teamCheck == Teams.Management then
		local NewSlot = script.Parent.LeaderboardFrame.HoldingFrame.Sample:Clone()
		NewSlot.Name = player.Name
		NewSlot:WaitForChild("TeamImage").Visible = true
	end
end)

localscript

--local Close = script.Parent.LeaderboardFrame.Close

--Disable Roblox's leaderboard.
game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)

local plr = game.Players.LocalPlayer
local Teams = game:GetService("Teams")
local replicatedStorage = game:GetService("ReplicatedStorage")
local ManagementEvent = replicatedStorage.ManagementTeam

local teamCheck = plr.Team

plr:GetPropertyChangedSignal("Team"):Connect(function()
	if plr.Team == Teams.Management then
		teamCheck = Teams.Management
		ManagementEvent:FireServer("test", teamCheck)
	end
end)

So does the RemoteEvent fire accordingly when the Player selects the Management team? I don’t see any print statements that attempts to print the Player’s team on the Scripts you provided.

Yes, it now fires when a player selects the management team. Before, it used to print “Choosing” since this is the neutral team. So, to combat against this, made " if plr.Team == Teams.Management then teamCheck = Management, which fixed the issue of the remote event firing the wrong team, but now I have an entirely separate bug to figure out

Local Script

--local Close = script.Parent.LeaderboardFrame.Close

--Disable Roblox's leaderboard.
game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)

local plr = game.Players.LocalPlayer
local Teams = game:GetService("Teams")
local replicatedStorage = game:GetService("ReplicatedStorage")
local ManagementEvent = replicatedStorage.ManagementTeam

local teamCheck = plr.Team

plr:GetPropertyChangedSignal("Team"):Connect(function()
	if plr.Team == Teams.Management then
		teamCheck = Teams.Management.Name
		ManagementEvent:FireServer("test", teamCheck)
	end
end)```

```lua
--Custom Leaderboard Script. Made by Leaderboard+ plugin (by Infinite_Visions).
--Find the plugin Documentation here: https://devforum.roblox.com/t/leaderboard-create-custom-leaderboards-in-studio/1338477

local Settings = script.Parent.Settings
local Path = nil
local Teams = game:GetService("Teams")
local replicatedStorage = game:GetService("ReplicatedStorage")
local managementEvent = replicatedStorage.ManagementTeam

--Handle Admins. If You Have no admins, ignore this.
local Admins = {
	"Infinite_Visions",
	"Example_Name_Here"
}

--Get Creator Id
local ownerId = nil
if game.CreatorType == Enum.CreatorType.Group then
	local PlaceInfo = game:GetService("MarketplaceService"):GetProductInfo(game.PlaceId)
	ownerId = game:GetService("GroupService"):GetGroupInfoAsync(PlaceInfo.Creator.CreatorTargetId).Owner.Id
else
	ownerId = game.CreatorId
end

--Setup Players Already In-Game
for i, player in pairs(game.Players:GetChildren()) do
	--Add a slot to the leaderboard
	local NewSlot = script.Parent.LeaderboardFrame.HoldingFrame.Sample:Clone()
	NewSlot.Name = player.Name
	
	--Handle Names
	local NameText = nil
	
	if Settings.DisplayNames.Value == true then
		NameText = player.DisplayName
	else
		NameText = player.Name
	end
	
	if Settings.UpperCase.Value == true then
		NewSlot.PlrName.Text = string.upper(NameText)
	else
		NewSlot.PlrName.Text = NameText
	end
	
	--Handle Icons
	if player.UserId == ownerId and Settings.ShowOwner.Value == true then
		NewSlot.Owner.Visible = true
	else
		if Settings.ShowAdmin.Value == true then
			for i = 1, #Admins do
				if player.Name == Admins[i] then
					NewSlot.Admin.Visible = true
				end
			end
		elseif game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,13376596) and Settings.CustomGamepass.Value == true then	
			NewSlot.GamepassSymbol.Visible = true
		elseif player.MembershipType == Enum.MembershipType.Premium and Settings.ShowPremium.Value == true then
			NewSlot.Premium.Visible = true
		end
	end
	
	--If CustomData, Handle DataChanges
	if Settings.CustomData.Value == true then
		Path = script.Parent.Settings.CustomData		
		Path.Changed:Connect(function()
			NewSlot.Currency1.Text = Path.Value
		end)
	end
	NewSlot.Visible = true
	--The Path to the Values you want displayed, if any.
	NewSlot.Parent = script.Parent.LeaderboardFrame.HoldingFrame
end

ServerScript

game.Players.PlayerAdded:Connect(function(player)
	--Add a slot to the leaderboard
	local NewSlot = script.Parent.LeaderboardFrame.HoldingFrame.Sample:Clone()
	NewSlot.Name = player.Name
	
	--Handle Names
	local NameText = nil
	
	if Settings.DisplayNames.Value == true then
		NameText = player.DisplayName
	else
		NameText = player.Name
	end
	
	if Settings.UpperCase.Value == true then
		NewSlot.PlrName.Text = string.upper(NameText)
	else
		NewSlot.PlrName.Text = NameText
	end
	
	--Handle Icons
	if player.UserId == ownerId and Settings.ShowOwner.Value == true then
		NewSlot.Owner.Visible = true
	else
		if Settings.ShowAdmin.Value == true then
			for i = 1, #Admins do
				if player.Name == Admins[i] then
					NewSlot.Admin.Visible = true
				end
			end
		elseif game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,13376596) and Settings.CustomGamepass.Value == true then	
			NewSlot.GamepassSymbol.Visible = true
		elseif player.MembershipType == Enum.MembershipType.Premium and Settings.ShowPremium.Value == true then
			NewSlot.Premium.Visible = true
		end
	end
	
	--If CustomData, Handle DataChanges
	if Settings.CustomData.Value == true then
		Path = script.Parent.Settings.CustomData		
		Path.Changed:Connect(function()
			NewSlot.Currency1.Text = Path.Value
		end)
	end
	NewSlot.Visible = true
	
	local function test(arg1, arg2)
		print("testing", arg1, arg2)
	end
		end)

managementEvent.OnServerEvent:Connect(function(player, teststring, teamCheck)
	if teamCheck == Teams.Management.Name then
		local NewSlot = script.Parent.LeaderboardFrame.HoldingFrame.Sample:Clone()
		NewSlot.Name = player.Name
		NewSlot:WaitForChild("TeamImage").Visible = true
	end
end)```

Maybe if you fire the name of the Team rather than the team object itself?