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!
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.