Did you forget to implement OnServerEvent?

I have a issue with my refit.

What is a refit? in Roblox terms, it’s basically a character that never dies, meaning that if the character was deleted, it would put itself back into workspace, back into the same position.

But in my case, the refit would be a remote. And the OnServerEvent Function is getting disconnected for some reason.


There is nothing online that meets the requirements for the succession of my script.

I’ll put you in my shoes. I have a LocalScript that is Continually firing the remote, and should never stop no matter what.
This is what happens.


The first “rebuilt” is the remote being created for the first time.
The first “fired” is when the remote has been fired by the same LocalScript.
The second “rebuilt” is me deleting the remote, and it rebuilding itself.
The second “fired” is the localscript still firing the remote, but the function just no longer gets used, thus creating the error.


Code:

-- Most code is left out due to security reasons.
--[[
Though, I WILL explain.
There are two events connected directly to ReplicatedStorage.
"DescendantRemoving","ChildRemoving".

The function simply rebuilds it whenever these two are fired. It has nothing to due with the main issue.
]]
function rebuild_rem()
        print("rebuilt")
        rem = Instance.new("RemoteEvent")
        rem.Name="CryzenMVCZ"
        rem.Parent = game.ReplicatedStorage
        rem.OnServerEvent:connect(function(p)
               print("fired")
        end)
end
rebuild_rem()

function rebuild_vizrem()
        remVis = Instance.new("RemoteEvent")
        remVis.Name = "CryzenMVCZ_Visualizer"
        remVis.Parent = game.ReplicatedStorage
        remVis.OnServerEvent:connect(function(p,l)
                if typeof(l) == "number" then
                        loudness = l
                else
                        p:Kick("lol nice try "..p.Name..". - Obj_ective")
                end
        end)
end
rebuild_vizrem()

What’s weird is that the other remote is basically doing the same thing, but it’s not erroring. But the first remote is having issues for some reason.


Questions, Suggestions, etc. are much appreciated.

Found the issue.
It was in the LocalScript firing the remote.
It seems that the variable did not get re-set, when it was supposed to, and it was firing the remote that was deleted.

2 Likes