Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is my RemoteEvent not firing?

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!

4 comments

1

Any errors and which script isnt working?

0

No error is registered, the .OnServerEvent() function is not fired.

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.

0

I've tested by making a variable with game:GetService("ReplicatedStorage"). Same output.

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.