ServerScript won't receive fired event?

Hi! I am trying to work on a script that gets fired, then checks a table, and so on.
But, for some reason the script never gets fired. I put prints after it gets fired, and when it is fired. The prints for when it is fired, are printed. The prints after it gets fired, are never printed.

Any help?

The Firing script part
local Citation = script.Parent.Parent.Parent
local Suspect = Citation.Values.Suspect
local Reason = Citation.Values.Reason
local Infraction = Citation.Values.Infraction

game.ReplicatedStorage.TicketFired:FireServer(Suspect, Reason, Infraction)
The script fired
 game.ReplicatedStorage.TicketFired.OnServerEvent:Connect(function(plr, Suspect, Reason, Infraction)
								print("ok, got fired")
								local PriceArray = {
									["Dog Without Leash"] = 50, 
									["Disorderly Conduct"] = 150, 
									["Expired Vehicle Tag"] = 150,
									--etc etc
								Infraction = PriceArray[Infraction.Text]
								-- HEre, you first get the Suspect's amount of money through te datastore or whatever. Save it as a local.
								--Next, you'll deduct the players cash using the PriceArray above, do that by using Suspect.Cash.Amount = PriceArray[Infraction.Text]
									game.ReplicatedStorage.TicketFired:FireAllClients(plr, Suspect, Reason, Infraction)

Any help is appreciated!!

1 Like

Is the server-side script a descendant of Workspace or ServerScriptService?

I now notice, it’s probably because it’s in startercharacterscripts

Edit: wasn’t the problem

Are you sure the server script runs? Put a print in the 1st line of it. Make sure to parent it to Workspace or ServerScriptService, as @Dandystan suggested

General architecture for client to server communication (comms as I abbreviate it) is tricky, hella tricky to debug too.
I hate to be that guy, but is your firing script part a Localscript?
Where are both of your scripts?

Note: (The script being in startercharacterscripts is fine, just means the script will run on every player’s character)

There is a tiny problem in your code. FireAllClients doesn’t require a player argument, as it already fires to all other clients. So changing

game.ReplicatedStorage.TicketFired:FireAllClients(plr, Suspect, Reason, Infraction)


game.ReplicatedStorage.TicketFired:FireAllClients(Suspect, Reason, Infraction)

should fix the problem.

1 Like

Out of curiosity, why are you then firing the details to all clients?

I know it runs because right before the line where it’s having problems, is what causes the UI to enable which has the firing script.

My firing script is a LocalScript which is in StarterCharacterScripts.
THe fired is in ServerScriptService now

My bad! I didn’t realize I had plr in there.

I fire to all clients then check if the client is the same name as the suspect and… it’s very complicated…

Couldn’t you just fire it to the player directly? :FireClient(game.Players:FindFirstChild('PLAYER_NAME'),args

I did not know that was possible… How would I receive it? Just like




I’m just theorizing here, but you might be able to do it like that. You’d be able to clone the LocalScript to the player, and then you would be able to fire the event.

For your local script, you need to confirm that the events are, in fact, there when the script runs (though this probably isn’t your error if you haven’t seen anything in the output).

To do this, you would need to get ReplicatedStorage and wait for your TicketFired event.

local TicketFired = game:GetService("ReplicatedStorage"):WaitForChild("TicketFired")

Using game:GetService(“SERVICE_NAME”) is generally better practice than using game.SERVICENAME, as with :GetService() if you’ve changed the name of the service object then it still works, however the latter would break.

This isn’t need for the server-side script within ServerScriptService.

EDIT: This is wrong, please refer to here and here where I got the information for this post (they were edited)

I was able to figure out by messing around with it…alot.

Would you care to share your fixed code with us?
It might help someone else who has a similar problem and the solution would save them having to raise another topic.