Cant fire remote event from script

I have a script that fires a remote event when something happens, for some reason nothing happens.

Script

task.wait(5)


local timer = script.Parent
local minutes = 0
local seconds = 15

repeat
	if seconds <= 0 then
		minutes = minutes - 1
		seconds = 59
	else
		seconds = seconds - 1
	end
		timer.Text = "Intermission: " .. tostring(seconds)
	task.wait(1)
until minutes <= 0 and seconds <= 0
timer.Visible = false
game:GetService("ReplicatedStorage").Events:FindFirstChild("Cutscene1"):FireAllClients()

Local Script

script.Parent.OnClientEvent:Connect(function()
	print("hi")
end)

2 Likes

Ok so from the look of it, your event is parented to the remote event, try parenting it to StarterPlayerScripts, StarterCharacterScripts, or PlayerGui

doesnt work. . . . … . . . . .

Did you change the code to the path of the remote event?

yeah . . … . . . . . . . . . … . . … . . . . . . . .

From looking at it, what is your main script parented to?

a text label … . … … . . . . . . .

Yeah ok, so scripts (or server scripts) shouldnt be used to change the text of a textlabel. Its best you use a local script to do this, for instance, on a server script parented to lets say ServerScriptService, sends a remote event to all clients telling them to display the countdown, the server then just does wait() how ever long you wanted to wait, and boom.

The purpose of this post is not the timer though. It is firing a remote event from a script and having it actually work (which it doesnt)

Looking at your repeat statement, it never exits the loop. Consider replacing

if seconds <= 0 then

with

if seconds <= 0 and minutes > 0 then

and see if it resolves your issue

Thats not the issue since I made a separate script that just waits 20 seconds and then fires the remote event and it still doesnt work.

If the timer never reaches 0, then the remote event wont fire

Testing the code, apparently it does actually exit the loop.

Where is the local script parented?

It does hit 0, it does fire but nothing happens

do what I said, as the script’s parent should be moved, as for best practice, but also cause it could be causing the problem.

Along with that any errors in the output?

There’s no errors. I put a script in serverscriptservice that just waited 20 seconds and fired the remote even and it still didnt do anything.

It was under a textlabel and then i changed it to be under startercharacterscripts

Can you print (“hello world”) in your local script? I want to see if it will print.

I don’t think you should be doing script.Parent.OnClientEvent.
Try putting the local script in StarterGui, and then have the remote event in ReplicatedStorage

@0ElonMuskEnjoyer0