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

Why is my RemoteEvent not firing?

Asked by 4 years ago

Howdy all!

I consider myself a slightly better than average scripter, but I'm completely stumped at this. I'm genuinely confused if I'm forgetting something. I've got a typical LocalScript that waits for a .touched event to run a :FireServer() on an event. I've attempted to print debug the script and it seems that the function runs UP TO the :FireServer().

Here's the local script that fires the server. The RemoteEvent is named "cleanEvent" and is located in the ReplicatedStorage.

function onTouch(x)
    print(x.Name) -- Checks out.
    if x.Name == "SpillPart" then
        print("Firing Event") -- Output: "Firing Event".
        game.ReplicatedStorage.cleanEvent:FireServer(x)
    elseif x.Name == "MessPart" then
        print("Firing Event") -- Output: "Firing Event".
        game.ReplicatedStorage.cleanEvent:FireServer(x)
    end
end

script.Parent.Touched:Connect(onTouch)

Here is the Script itself.

game.ReplicatedStorage.cleanEvent.OnServerEvent:connect(function(plr, Part)
    print("Received Word")
    if Part.Name == "MessPart" then
        print("Categorized as Mess") -- No output recognized.
        [Insert Rest of Script]
    elseif Part.Name == "SpillPart" then
        print("Categorized as Spill") -- No output recognized.
        [Insert Rest of Script]
    end
end)

I appreciate any and all help! Thanks!

1
Any errors and which script isnt working? JesseSong 3916 — 4y
0
No error is registered, the `.OnServerEvent()` function is not fired. TaxesArentAwesome 514 — 4y
1
game:GetService("ReplicatedStorage"), it's part of the server, not the client so I don't believe they can access it through a local script without :GetService()? Not sure. KingDomas 153 — 4y
0
I've tested by making a variable with game:GetService("ReplicatedStorage"). Same output. TaxesArentAwesome 514 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

The error has been resolved by Discord. I had a while true do loop before the event declaration which halted it dead in its tracks. I've moved my loop below the event and it's working now.

Ad

Answer this question