Remote event wont fire

I have this script that fires a remote event back to the server inside an OnClientEvent function however everything is printing it’s just the remote event (JoinPartyEvent) that wont fire, I double checked my variables and still couldnt find the solution.

PartyEvent.OnClientEvent:Connect(function(Owner, Chapter, MaxPlayers, cmd)
	if cmd == "DisplayPartyOnFrame" then
		local UserId = Players[Owner.Name].UserId
		local ProfileImage = game.Players:GetUserThumbnailAsync(UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size100x100)

		local PartyDisplayFrame = script.PartyDisplayFrame:Clone()
		PartyDisplayFrame.PartyName.Text = Owner.Name.."'s party"
		PartyDisplayFrame.PlayerNumber.Text = "1/"..MaxPlayers
		PartyDisplayFrame.Chapter.Text = "Chapter: 1"--..tonumber(string.match(Chapter, "%d+$"))
		PartyDisplayFrame.ProfileIcon.Image = ProfileImage
		PartyDisplayFrame.Name = Owner.Name

		PartyDisplayFrame.Parent = PartiesPage.PartiesScrollingFrame
		
		PartyDisplayFrame.ClickDetector.Activated:Connect(function()
			print("clicked")
			PartiesPage.Visible = false
			InPartyPage.Visible = true
			PlayButton.Visible = false
			JoinPartyEvent:FireServer("JoinParty", Owner)
			print("fired")
		end)
	end
end)

Are you able to show the code for the received party event?

JoinPartyEvent.OnServerEvent:Connect(function(player, cmd, Owner)
	print("joinparty received")
	if PartyService:GetPartyPlayerIsIn(player) == nil and cmd == "JoinParty" then
		print("condition true")
		local OwnerOfParty = Players[Owner]
		print(OwnerOfParty)              
		local OwnersParty = PartyService:GetPartyPlayerIsIn(OwnerOfParty)
		if PartyService:GetPartyOwner(OwnersParty) == OwnerOfParty then
			PartyService:AddPlayer(player, OwnersParty)
		end
	end
end)

It could be that it’s expecting 3 variables and instead is being given 2?

Yeah i had

JoinPartyEvent:FireServer(Player, "JoinParty", Owner)

before and it still didnt work :confused:
I thought that I didnt need to put the player there because the .OnServerEvent has the player it came from already

Okay, where is the script located? That could effect it.

When you fire server, first agrument in the server script will be player, so no need to send it, that was good. Maybe check if JoinPartyEvent is declared correctly

1 Like

Client script: StarterGui
Server: ServerScriptService
I doubt this is the issue

Yeah that seems fine, weird… Maybe it’s something to do with how your declaring the remote event?

IT could be that I have 2 different OnServerEvents in one script?

If its connected to different RemoteEvents then it should not be problem, otherwise it may be the issue.

I highly doubt it, I’ve never had an issue with that.

well they kinda are connected

PartyEvent.OnServerEvent:Connect(function(player, cmd, Chapter, MaxPlayers)
	--if PartyService:GetPartyPlayerIsIn(player) == nil and cmd == "Create" then	
	--	local PartyCreated = PartyService:Create(player, 13007182239, MaxPlayers)
		PartyEvent:FireAllClients(player, Chapter, MaxPlayers, "DisplayPartyOnFrame")

	--elseif PartyService:GetPartyPlayerIsIn(player) ~= nil and cmd == "Start" then
		--PartyService:StartParty(PartyService:GetPartyPlayerIsIn(player))
	--end
end)

The client script .OnclientEvent function is triggered from another Remote event function inside the server script

But partyEvent on both the server and then on client side is executed, right ? Just the JoinPartyevent do not want to execute.

Yes if thats the issue perhaps Ill make a seperate remote event to communicate but the way i’ve done it now is with a “cmd” variable if you can see

Yea I see that, so these are written in output if you click that DisplayFrame ?

PartyDisplayFrame.ClickDetector.Activated:Connect(function()
			print("clicked") --this one
			PartiesPage.Visible = false
			InPartyPage.Visible = true
			PlayButton.Visible = false
			JoinPartyEvent:FireServer("JoinParty", Owner)
			print("fired") --and this one
		end)

Yeah but the prints in the server script dont show in the output from the JoinPartyEvent.OnServerEvent