Kick script - Rate my script

This script is literally like when you touch a brick, you get kicked and a server warning will be issued.

script.Parent.Touched:Connect(function(hit)
script.Parent.Alert.Disabled=false
wait(5)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
plr:Kick(“BRUH MOMENT. You kicked yourself out from the server and you activated the Anti Exploiting System, GG”)
script.exploiter:Play()
local h = Instance.new(“Hint”,workspace)
h.Text = “The ENU Intelligence Team has detected attempted access to the secret sector. Initiating countermeasures. Playing MusicThatSoundsTerrible.mp3. Shutdown in T-1 minute.”
wait(5)
script.music:Play()
wait(55)
script.Parent.Shutdown.Disabled = false
end)

This is the main script.

local function callback(Text)

if Text == “Access denied.” then

print (“Disable”)

elseif Text == (“Failure: Anti Exploit is active.”) then

print (“Stop Music”)

end

end

local NotificationBindable = Instance.new(“BindableFunction”)

NotificationBindable.OnInvoke = callback

game.StarterGui:SetCore(“SendNotification”, {

Title = “Warning”;

Text = “Anti-Exploit Activation In Progress”;

Icon = “”;

Duration = 5;

Button1 = “Access denied.”;

Button2 = “Failure: Anti Exploit is active.”;

Callback = NotificationBindable;

})

That is the Alert script and comes the shutdown script.

while wait() do --Continually loops
for _,v in pairs(game.Players:GetChildren()) do – Gets a table of all players and goes through it.
v:Kick(“This server has been shutdown by the P:ENU Anti Exploiting System. - Mining diamonds since 2015”) – Kicks the player. You can change “This Server has been shutdown.” to anything you want.
end
end

5 Likes

It can easily be bypassed :man_shrugging:
Is the ‘shutdown script’ ServerSided or ClientSided?

If it is ServerSided then it is a good way for exploiters to ruin your game since you are kicking every player in the server

1 Like

Also, could you please format it, I really can’t read it…

1 Like

The person who touched the part gets kicked, but the shutdown script is something else

1 Like

Ah ok, I thought it was apart of Part Touch script.

1 Like

But again, you have a point. Exploiters can TP people to the kick part

Exploiters can’t tp people to the kick part, unless you have an Event that teleports a player to a position on the server.

I don’t have one. Thanks for the reminder by the way!

This category is for requesting code improvements, not ratings. Please read the category guidelines before posting here. What improvements are you looking for specifically? What dissatisfies you about this code?

If you aren’t able to answer the questions as posed in the Code Review category guidelines, you’re better off posting this to Scripting Support for comments and such. This isn’t an open feedback category albeit a lot of new posts using the category that way, it’s meant to be for focused feedback.

1 Like

What do you want to prevent with this?

1/10 for sure, your Touched function doesn’t even work. Hit.Parent needs to be defined, you can’t just use GetPlayerFromCharacter, and Hit.Parent without checks. What are you doing?

2 Likes