-
Notifications
You must be signed in to change notification settings - Fork 0
/
Kick Parts.lua
53 lines (41 loc) · 1.35 KB
/
Kick Parts.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
--[[
!! Installation guide
This script will collect parts tagged with "Kick Parts"
- Set in PartTag variable
The script will use the HD admin API to check the Player's role
- Depso
]]
----// Configuation
local PartTag = "Kick Parts"
local KickMessage = "Bozo detected"
local MiniumRank = 1
--// Services
local CollectionService = game:GetService("CollectionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
--// HD Admin
local HDAdminSetup = ReplicatedStorage:WaitForChild("HDAdminSetup")
local HdAdminMain = require(HDAdminSetup):GetMain()
local HdAdmin = HdAdminMain:GetModule("API")
--// The kill function itself
local function Touched(Limb)
local Character = Limb.Parent
if not Character then return end
local Player = Players:GetPlayerFromCharacter(Character)
if not Player then return end
--// Admin check
local RankId = HdAdmin:GetRank(Player)
if RankId < MiniumRank then
Player:Kick(KickMessage)
end
end
--// Add connections for parts added
local function MemberAdded(Object: BasePart?)
if not Object:IsA("BasePart") then return end
Object.Touched:Connect(Touched)
end
--// Add connections for tag members
CollectionService:GetInstanceAddedSignal(PartTag):Connect(MemberAdded)
for _, Object in next, CollectionService:GetTagged(PartTag) do
MemberAdded(Object)
end