Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is OnServerEvent not firing?

Asked by
Mowblow 117
5 years ago
Edited 5 years ago

I have a local script in PlayerScripts, a server script in a model, and a remote event in the model.

This is the client code:

local mouse = game.Players.LocalPlayer:GetMouse()
local updating = false
local truck = game.Workspace.jihadtruck
local mouseevent = truck.MouseTruck
local fireevent = truck.FireTruck
updating = true
    repeat
        print("clntupdate")
        truck:WaitForChild("MouseTruck"):FireServer(mouse.Hit.p)
        wait(.1)
    until updating == false

This is the server code:

local mouseevent = truck.MouseTruck
mouseevent.OnServerEvent:connect(function(plr,hit)
    print("svrupdate")
end)

"clntupdate" prints but "svrupdate" does not.

I have no clue what is wrong, any help?

0
is the server script enabled? is there a remote event canned MouseTruck? Gameplayer365247v2 1055 — 5y
0
its also better to include the whole script or at least the parts that explain each other Gameplayer365247v2 1055 — 5y
0
Just updated it. Yeah, there's a remote event in the model titled "MouseTruck". No errors are thrown when calling the function. Mowblow 117 — 5y

Answer this question