Remote Event not getting picked up by the client

Hi guys, I’m trying to fire a RemoteEvent on the server to the client. I’m 100% sure it fires since I added a print (which is printing)

This is my code on the server:

game.Players.PlayerAdded:Connect(function(Player)
	print("Plr added!")
    local HighestRankId = 13
	 for i = 1,#Gamepasses do
			local pass = Gamepasses[i][1]
			local rank = Gamepasses[i][2]
			local name = Gamepasses[i][3]
        if Player:GetRankInGroup(GroupId) < rank and MarketplaceService:UserOwnsGamePassAsync(Player.UserId, pass) then
            HighestRankId = HighestRankId < rank and rank or HighestRankId  
		else
			wait(5)
			print("NOPEH")
	game.ReplicatedStorage.Nope:FireClient(Player, "Nope")
end
    end

Knipsel22
As you can see, it does print the Nope. That’s why I’m so confused why the even’t ain’t firing. Yes there is an actual RemoteEvent called “Nope” in RepStorage.

This is my code on the CLIENT:

local RepStorage = game:GetService("ReplicatedStorage")
local pass = RepStorage:WaitForChild("Nope")
pass.OnClientEvent:Connect(function()

Help would be appreciated!

May we see the hierarchy of the scripts’ locations?

Yes ofcourse! The server script is in ServerScriptService.
The local script is in a TextLabel which is parented to a ScreenGui

Is it possible that the game is sending the information to the client before the client is even able to accept it?

Can you show us the rest of the client script? Because, from what it seems, you should be getting a parsing error with that, as there is no end statement to the function nor a closing parenthesis to the Connect function.

Don’t think so, because I added a

wait(5)

before It sends the info to the client

Local Script

game.ReplicatedStorage:WaitForChild("RemoteEvent").OnClientEvent:Connect(function(msg)
local plr = game.Players.LocalPlayer
script.Parent.Text = msg
local RepStorage = game:GetService("ReplicatedStorage")
local pass = RepStorage:WaitForChild("Nope")
pass.OnClientEvent:Connect(function()
	warn("Nope Received.")
	script.Parent.Text = "No available promotions found! Kicking player.."
	wait(10)
	plr:Kick("\nAtekcore: No available promotions found!")
   end)
end)

I don’t know as to why a remote event signal was detected, but I’d advise highly against having the client kick itself. Things like kicks should be done on the server. Never trust the client.

Just put the wait statement and the kick statement in the server, after it fires the remote event.

game.ReplicatedStorage:WaitForChild("RemoteEvent").OnClientEvent:Connect(function(msg)

Maybe it’s because this line didn’t fire yet, check if it did by using a print command, if it didn’t there’s your solution.

1 Like