RemoteEvent not working

Hello, i made this script and it works but is not firing the event
This is the script that fires the event
(both event is not firing)
i removed the local with the hat on the script below, it works very well, just dont fire anything

local cd = script.Parent.ClickDetector
local plr = game.Players.LocalPlayer
local remoteevent = game.ReplicatedFirst.Value1ToHat
local remoteevent2 = game.ReplicatedFirst.StartCountdownToHat

cd.MouseClick:connect(function(player)
	
	if player.ReadyForHat.Value == '1' then
		remoteevent:FireClient(player)
		print("FiredEventForShowGui")
	end		
	
	if player.ReadyForHat.Value == '0' then
		remoteevent2:FireClient(player)
		player.ReadyForHat.Value = 1
		
	if player.Character then
		if not player.Character:FindFirstChild("UnicornHood") then
			local hum = player.Character.Humanoid
			local hats = {}
			for _,v in pairs(hum:GetAccessories()) do
				table.insert(hats, v:Clone())
			end
			hum:RemoveAccessories()
			local clone = hat:Clone()
			clone.Parent = player.Character
			wait(30)
			clone:Destroy()
			for _,v in pairs(hats) do
					hum:AddAccessory(v)
					player.ReadyForHat.Value = 0
				end
			end
		end
	end
end)

and this is the script that receives the fire

local remoteevent = game.ReplicatedFirst.Value1ToHat
local plr = game.Players.LocalPlayer
local secondsleft = plr:WaitForChild("TimeLeftForHat")


remoteevent.OnClientEvent:Connect(function()
	if plr.TimerReadyForHat.Value == '1' then
		print("timerison")
	end
	if plr.TimerReadyForHat.Value == '0' then
		plr.TimerReadyForHat.Value = 1
		plr.PlayerGui.Warn1Hats.Hats.Visible = true
		plr.PlayerGui.Warn1Hats.Hats.Text = "You need wait " ..secondsleft.Value.. " seconds for try a new hat!"
		wait(3)
		plr.PlayerGui.Warn1Hats.Hats.Visible = false
		plr.TimerReadyForHat.Value = 0
	end
end)
---

i made the test to do this

local plr = game.Players.LocalPlayer
local remoteevent = game.ReplicatedFirst.Value1ToHat
local secondsleft = plr:WaitForChild("TimeLeftForHat")

remoteevent.OnClientEvent:Connect(function(playeractive)
print("whyisnotworking?")

end)

And dont prints nothing, dont give any error on console and dont fire anything too, can someone help?

2 Likes

Is ReadyForHat an IntValue or a StringValue? It could be that you placed quotation marks around 1 and 0 in the if statements

if player.ReadyForHat.Value == '1' then
if player.ReadyForHat.Value == '0' then

Try removing those ’ ’ and see if it fixes anything. Also wait, is the first script a localscript or a server script? You can’t run FireClient in localscripts, and if it’s a regular script, you can’t get LocalPlayer from a regular script

1 Like

The first script is a Normal Script located on workspace.

1 Like

The ReadyForHat is working, all on this script that is not working is the fire event.

1 Like

So the issue is that FireClient is not working?

1 Like

Yeah!

aaaaaaaaaaaaaaaaaaaaaaaaaaa
I put a lot of aaaa for can to publish

1 Like

Try removing the between the 1 and 0, I think it has to be cause of those

1 Like

Call from server or client?

If it is server, remove this:

and that player on every line.

Otherwise, change the remote event to BindableEvent and this: FireClient for this Fire on every line.

Where is the localscript located, localscripts won’t run in workspace, try moving it to starterPlayer > starterPlayerScripts

The reason this script does not work is because RemoteEvents are used for the communication between the server and the client, and in your case, both scripts are client. The FireClient only works on server-side. Hopefully this helps!

In addition to what @DargoA said, if you’re handling the Event client wise I’d recommend using BindableEvents instead as they’re pretty much the opposite of what RemoteEvents do (Aka firing client-client sided)