Saw a suggestion for a serversided anti-fly involving humanoid.FloorMaterial and decided to write a quick little test, and it seems to work reliably. The only concern I have is whether or not humanoid.FloorMaterial is able to be modified in any way by the client. I would assume not given that it appears to be a readonly value, but wanted to get a second opinion anyways.
Here’s the code:
local WarnTable = {}
game:GetService("RunService").Heartbeat:Connect(function()
for _,v in pairs(game.Players:GetPlayers()) do
local char = v.Character
if char then
local FloorMaterial = char.Humanoid.FloorMaterial
if FloorMaterial == Enum.Material.Air then
if WarnTable[v.UserId] == nil then WarnTable[v.UserId] = os.time() end
if WarnTable[v.UserId] + 10 < os.time() then
WarnTable[v.UserId] = nil
v:LoadCharacter()
end
else
WarnTable[v.UserId] = nil
end
end
end
end)
The only other concern I have with this is that heartbeat connection in servers with 40+ people in it. Maybe a less frequent loop?