Pretty simple question, when I use this script. The playerChatted function does not fire.
local teleportService = game:GetService("TeleportService")
local playerService = game:GetService("Players")
local messageService = game:GetService("MessagingService")
local remoteFunction = game.ReplicatedStorage.callSystem
messageService:SubscribeAsync("CallSystem", function(DataTable)
local managers = {}
for _, player in pairs(playerService:GetPlayers()) do
if player:GetRankInGroup(32532119) >= 8 then
local teleport = remoteFunction:InvokeClient(player, DataTable.Data.Username, DataTable.Data.DisplayName, DataTable.Data.helpMessage)
end
end
end)
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
local teleport = remoteFunction:InvokeClient(player)
print(teleport)
end)
end)
But if I put it above the SubscribeAsync function it does work.
local teleportService = game:GetService("TeleportService")
local playerService = game:GetService("Players")
local messageService = game:GetService("MessagingService")
local remoteFunction = game.ReplicatedStorage.callSystem
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
local teleport = remoteFunction:InvokeClient(player)
print(teleport)
end)
end)
messageService:SubscribeAsync("CallSystem", function(DataTable)
local managers = {}
for _, player in pairs(playerService:GetPlayers()) do
if player:GetRankInGroup(32532119) >= 8 then
local teleport = remoteFunction:InvokeClient(player, DataTable.Data.Username, DataTable.Data.DisplayName, DataTable.Data.helpMessage)
end
end
end)
This code is vulnerable. An exploiter can infinitely yield the return of InvokeClient because the server asks the client for information. This will prevent any data being sent to clients after them.
You’re not using the RemoteFunction data here, have you considered using a RemoteEvent?
I don’t get it, why can exploiters use this remote function?
Basically; if an exploiter has a rank above 8 in the group and the remote function is fired for them, they can infinitely stall the response of the function which basically means the remote function won’t fire for any body else in that server.
All you have to do is replace the remote function with a remote event; same thing but it doesn’t require a return. Only use remote function if you need data returned from the client.
I probably didn’t explain it the best, you can refer to the docs for remote function for more information.