Remote Event not firing

Hello devs, i have been making a event system. this system has a remote called “Players” that is supposed to fire from a local script into a server script. this script is located in a “ScreenGui”.
(I am getting no errors btw)

What did i try: Making a new value inside the “ScreenGui” and putting a value of 5 into it and see if it fires but it still doesnt for some reasons. Turned on http and restarting studio (did nothing). Iv spoke to 2 really good scripters that are telling me that this should work and that they dont know what is wrong with it.

Here what it looks like in the explorer:
image

local script:

local rep = game:GetService("ReplicatedStorage")
local plr_event = rep:WaitForChild("GameEvents"):WaitForChild("Players")
local timer_ready = rep:WaitForChild("GameEvents"):WaitForChild("GetReadyTimer")
local ui = script.Parent

while task.wait() do
	if timer_ready.Value == 10 then
		print("worked on client")
		plr_event:FireServer()
		print("fired on client")
		ui.No.Visible = true
		ui.Yes.Visible = true
		ui.Effect1.Visible = true
		ui.Effect2.Visible = true
		ui.JoinText.Visible = true
	end
end

module script:

module.Events = {
	function()
		plr_event.OnServerEvent:Connect(function(plr)
			print("fired server")
			local ui = plr.PlayerGui:WaitForChild("EventsGui")
			local play_event = plr.Character:FindFirstChild("PlayingEvent")
			print("works1")
			--------------------------------------------------------------------------------------
			ui:WaitForChild("Yes").MouseButton1Click:Connect(function()
				ui:WaitForChild("Yes").Visible = false
				ui:WaitForChild("No").Visible = false
				ui:WaitForChild("Effect1").Visible = false
				ui:WaitForChild("Effect2").Visible = false
				ui:WaitForChild("JoinText").Visible = false
				plr.Character.PrimaryPart.CFrame = game.Workspace.TpPlaces.RaceObby.Tp2.CFrame
				play_event.Value = true
				print("works2")
			end)

this module script has a lot more in it like a timer script and other events that are randomely picked.

whats happening here is that the 2 prints in the local script arent printing so i would assume that the remote is not firing and that something is wrong. The thing is i know the value is getting changed and that the value is right since it is counting from 10 to 0 (this is handled by the module script since it has a event section and a timer section) so the value should be right.

A module is sort of like a list of instructions first it has to be read before it completes its actions. Some things that might be causing your issue is

1: Your module was never initialized

2: You are requiring the module in a client script therefor erroring when trying to handle a remote request

https://developer.roblox.com/en-us/api-reference/class/ModuleScript

Is this the module script? If so you forgot to require!

Since you said the 2 prints on the client aren’t sent; Make sure the value is actually reached;

Instead of using a task.wait() loop, you could use the timer_ready.Changed event to find if it changes to 10 in the first place. (it would also save you from a lot of spam if it does reach that)

For debugging, you could print the new value every time it changes, so it would output whether or not that same value is ever being reached.

i actually forgot that this function was a thing i will try that ty

so i have tried this:

local rep = game:GetService("ReplicatedStorage")
local plr_event = rep:WaitForChild("GameEvents"):WaitForChild("Players")
local timer_ready = rep:WaitForChild("GameEvents"):WaitForChild("GetReadyTimer")
local ui = script.Parent

timer_ready.Changed:Connect(function()
	print(timer_ready.Value)
	if timer_ready.Value == 10 then
		print("worked on client")
		plr_event:FireServer()
		print("fired on client")
		ui.No.Visible = true
		ui.Yes.Visible = true
		ui.Effect1.Visible = true
		ui.Effect2.Visible = true
		ui.JoinText.Visible = true
	end
end)

here the output:
image
but it still doesnt work

Have you considered using tonumber() on timer_ready.Value by chance? It very well could be the issue all things considered, especially since you have just confirmed the value is reached. Question is; Is it reached as a string?

1 Like

it is a string value is it whats wrong?

Yeah. Lua doesn’t automatically convert strings to numbers when they are compared against numbers, nor vice-versa.
image

ohh so i should change that to a number value and this should fire the remote

Well… yes, but it could save you some headache by simply adding a tonumber() wrapping to the value.

ty for the help appreciate it!

If you’re working with numbers anyway you should be using an IntValue/NumberValue object not a StringValue object.

I’ll never understand why people use StringValues to store numbers expressed as strings.