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

RemoteEvent On Server Not Responding?

Asked by 4 years ago

The client is firing a remote event and the server is not doing anything about it. It doesn't print 'fired'.

Server

remote.OnServerEvent:Connect(function(plr,key,strings)
    print('fired')
    if key == 'key123' then
        local gui = script:FindFirstChildOfClass("ScreenGui"):Clone()
        gui.Parent = plr.PlayerGui
        gui.Enabled = true
    elseif key == 'key321' then
        Loadstring(strings) -- Using Module so its suppose to be a capital L
    end
end)

Client

local key = 'key123'
for i, v in pairs(game.Workspace:GetDescendants()) do
    if v.ClassName == 'RemoteEvent' then 
    v:FireServer(key)
    print(v.Name)
    end
     end

1 answer

Log in to vote
0
Answered by 4 years ago

I actually had an error similar to this today. First, I don't believe you're using the correct loop for what you're wanting to do. Consider the following.

local key = 'key123'
for _,i in pairs(game.Workspace:GetDescendants()) do
    if i.ClassName == 'RemoteEvent' then 
        i:FireServer(key)
        print(i.Name)
    end
end

Furthermore, be sure that you don't have any looping functions before your event firing. In my situation, I had a while true do loop that stopped my event dead. Make sure that an event such as this is given priority placement in your script, that way it isn't interrupted.

If this helped at all, consider accepting this answer. If not, comment below and I'll be sure to help you further.

0
Not sure what you did differently from my code besides change the variable names. Nothing different happens. GreenBushed 13 — 4y
Ad

Answer this question