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

How would I ensure that this script stops or breaks upon the data being sent for a certain player?

Asked by
0_2k 496 Moderation Voter
5 years ago
Edited 5 years ago

To go in more depth of the question, if there's been a log that a player has done something, I want the script to stop running for that person if possible, but unsure how I would go about that. I was thinking about using a variable setting if it was sent, but I don't feel too safe going about doing that.

Anyways here's the code if you'd want to take a review.. Server Script

-- >> Variables
local remote = game.ReplicatedStorage:WaitForChild("Il1IIl1l1Il1")
local HS = game:GetService("HttpService")
local deb = false

-- Webhook Function
function webhookLog(message, plr, FPS)
    local payload = HS:JSONEncode({
        content = "**Name:** "..plr.Name.."\n**Reason:** "..message.."\n**FPS:** "..FPS,--.."\n**Ping:** "..ping,
        username = plr.Name
    })

    HS:PostAsync("webbylinkee", payload)
end

-- Functioning
remote.OnServerEvent:Connect(function(plr, response, FPS)
    if response == "Hopper" then
        if not deb then
            deb = true
            webhookLog("Caught using btools", plr, FPS)
            wait(5)
            deb = false
        end
    end

    if response == "Fly" then
        if not deb then
            deb = true
            webhookLog("Caught flying", plr, FPS)
            wait(5)
            deb = false
        end
    end

    if response == "Hum" then
        if not deb then
            deb = true
            webhookLog("Caught attempting to god themselves", plr, FPS)
            wait(5)
            deb = false
        end
    end
end)

Client Script

-- >> Variables
local remote = game.ReplicatedStorage:WaitForChild("Il1IIl1l1Il1")
local players = game:GetService("Players")
local plr = players.LocalPlayer
local HS = game:GetService("HttpService")

-- >> Wait for the following to load in
repeat wait() until plr.Character
repeat wait() until plr:FindFirstChild("Backpack")

-- >> Loaded in
local char = plr.Character
local backpack = plr:WaitForChild("Backpack")

-- >> Functioning << --
-- Ping Check

-- FPS Check
local heartBeat = game:GetService("RunService").Heartbeat
local lastIteration, Start
local FPS
local frameUpdateTable = { }

local function heartBeatUpdate(num)
    lastIteration = tick()
    for index = #frameUpdateTable, 1, -1 do
        frameUpdateTable[index + 1] = (frameUpdateTable[index] >= lastIteration - 1) and frameUpdateTable[index] or nil
    end

    frameUpdateTable[1] = lastIteration
    local currentFPS = (tick() - Start >= 1 and #frameUpdateTable) or (#frameUpdateTable / (tick() - Start))
    currentFPS = math.floor(currentFPS)

    FPS = currentFPS
end
--  Anti Btools
backpack.ChildAdded:Connect(function(obj)
    if obj:IsA("HopperBin") then
        remote:FireServer("Hopper", FPS)
        --webhookLog("Caught using btools", plr)
    end
end)

local HRP = char:WaitForChild("HumanoidRootPart")

-- Anti God
char.ChildRemoved:Connect(function(obj)
    if obj:IsA("Humanoid") then
        remote:FireServer("Hum", FPS)
        --webhookLog("Caught trying to god themselves", plr)
    end
end)

function checkTeleport()
    if HRP == nil then
        remote:FireServer("hNil")
        return
    end

    local firstPos = HRP.Position

    delay(1, function()
        local secondPos = HRP.Position

        if (secondPos - firstPos).magnitude >= 140 then
            remote:FireServer("tele")
            return
        end
    end)
end

-- >> Better Anti Expl0it
me = script.Parent:FindFirstChild("Humanoid")
local testCounter = 0
local lastTime = 0
local lastState = 0

function checkState(state)
    -- Anti Jump
    if state == Enum.HumanoidStateType.Seated then
        if lastTime > os.time() - 1 then
            testCounter = testCounter + 1

            if testCounter > 2 then
                remote:FireServer("jump", FPS)
            end
        else
            lastTime = os.time()
            testCounter = 0
        end
    end

    -- Anti Fly
    if state == Enum.HumanoidStateType.Flying then
        remote:FireServer("Fly", FPS)
    end

    -- Anti Speed
    if me.WalkSpeed > 16 then
        remote:FireServer("noob", FPS)
    end

    -- Anti Noclip
    if state == Enum.HumanoidStateType.StrafingNoPhysics then
        remote:FireServer("Noclip", FPS)
    end
end

me.StateChanged:Connect(checkState)


Start = tick()
heartBeat:Connect(heartBeatUpdate)
0
I'd try a variable setting and see how that reacts. Just2Terrify 566 — 5y
1
Gotcha, will try thanks 0_2k 496 — 5y

Answer this question