FireClient works in Studio, not in Roblox

Hey Everyone, I want to first clarify that I do not script often and would like some assistance with an issue that is confusing me.

The issue I am having is that the script works just fine in Roblox Studio, no issues at all actually.
However, when I try to make it run in Roblox it gives me a player error, is there something I’m missing?

Because at this point it’s probably right in my face, and ill never be able to find it.

(Note: I have tried using the script under the workspace model and ServiceScriptService)

(Server Script)

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:WaitForChild("SpeedCamera3")
local Players = game:GetService("Players")

local Dectector = game.workspace["Traffic Cameras"].SpeedEnforcementCamera3.SpeedRadar
local Speed = game.Workspace["Traffic Cameras"].SpeedEnforcementCamera3.Speed

local flashlight = game.workspace["Traffic Cameras"].SpeedEnforcementCamera3.Flashlight
local flashlight2 = game.workspace["Traffic Cameras"].SpeedEnforcementCamera3.Flashlight2

game.Workspace["Traffic Cameras"].SpeedEnforcementCamera3.SpeedRadar.Touched:connect(function(hit)
        if (math.floor(hit.Velocity.magnitude / 1.8)) >= 25 then

        local User = Players:GetPlayerFromCharacter(hit.Parent)
        Speed.Value = math.floor(hit.Velocity.magnitude / 1.8)

        RemoteEvent:FireClient(User)
        Dectector.CanTouch = false

                flashlight2.Material = Enum.Material.Neon
                flashlight.SpotLight.Enabled = true
                flashlight2.SpotLight.Enabled = true
            wait(0.000000000000000001)
                flashlight2.Material = Enum.Material.Ice
                flashlight.SpotLight.Enabled = false
                flashlight2.SpotLight.Enabled = false
            wait(0.000000000000000001)
                flashlight2.Material = Enum.Material.Neon
                flashlight.SpotLight.Enabled = true
                flashlight2.SpotLight.Enabled = true
            wait(0.000000000001)
                flashlight2.Material = Enum.Material.Ice
                flashlight.SpotLight.Enabled = false
                flashlight2.SpotLight.Enabled = false

            wait(15)
            Speed.Value = "Null"
            Dectector.CanTouch = true
    end
end)

ALSO SORRY!
To any actual scripters if this is a mess, my bad haha.

I know this won’t solve the problem. But in the terms of organisations, remove those wait(). It won’t affects anything to your code since you’re putting low decimals numbers

i see through your code, there’s nothing wrong with it. Mind giving the fired local script?

local User = Players:GetPlayerFromCharacter(hit.Parent)
Speed.Value = math.floor(hit.Velocity.magnitude / 1.8)

if not User then return end
RemoteEvent:FireClient(User)