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

Why is my anti-virus script not working?

Asked by 9 years ago

Ok, so I wanted to make these scripts that make your game safe. I have an anti-kick script and an anti-reset script. (I have a no-reset script in starterpack. here's my anti-kick script:

local player = game.Workspace.LocalPlayer
local hax = game.Players.LocalPlayer:Destroy() -- detect if someone kicks a player
print('hackers, beware. Troys anti-virus is protecting the game from harm. the status is'..game.Workspace.AntiVirus.Value)
while true do -- to do multiple scans so it wont mess up once the hacker comes back or another hacker joins.
if hax then -- to scan if some player kicks some other player
player:Destroy() -- to kick the hacker
m = Instance.new("Message")
m.Text = "Troy's anti-virus has found a hacker and kicked him for deleting a player. his name is"..player.Name
wait(1/5)
m:Remove()
end
end

and my anti-reset script is here along with it's linked source:

while wait() do
    local char = player.Character
    if char and enabled then
        if char:findFirstChild("Humanoid") then
            char.Humanoid.Name = "humanoid"
        end

local player = game.Workspace.LocalPlayer
local hax =  player.Humanoid.Health == 0
while true do
if hax then
player:Destroy()
m = Instance.new("Message")
m.Text = "Troy's anti-virus has found a hacker and kicked him for Force Resetting a player. his name is"..player.Name
wait(1/5)
m:Remove()
end
end

Thanks for reading! please answer!

1 answer

Log in to vote
3
Answered by 9 years ago

That script is...Eh..Messed up.

In the script, you want to kick the player who is already removed? It's not working, because your going really advanced for the stage you are at. local hax = game.Players.LocalPlayer:Destroy() -- detect if someone kicks a player Does not detect if someone kicks the player, It deletes the player instantly.

Also, Game.Workspace.LocalPlayer makes no sense. You can't get a LocalPlayer in workspace. Game.Players:GetPlayerFromCharacter(Game.Players.LocalPlayer) is what it should be.

Basically, the whole script confuses me.

I can see through your previous questions you havent learnt scripting properly. Go through scripting. Don't guess, research. Watch through some youtube videos on scripting

https://www.youtube.com/playlist?list=PLA4609EA2E5307C94 Is good. Watch the series.

There is a wiki, you know.

http://wiki.roblox.com/index.php

2
"Game.Players:GetPlayerFromCharacter(Game.Players.LocalPlayer)" Would not work. game.Players.LocalPlayer is already the player. iaz3 190 — 9y
0
Thanks, Maxa. If you want to know what i'm doing, I want to scan if a player is removed by a player then print the player's name and kick the hacker. TroytheDestroyer 75 — 9y
Ad

Answer this question