see take a look at my code
Also, this does not use string.sub yet
--[==[
Copyright xXScriptzXx (INC.)
Don't you dare copy!
This will be re-write in 2.0
--]==]
local isAdmin = {"wtfsamcrap"}
--[[
Commands:
kill/me
--]]
function tableContains(t, value)
for _, v in pairs(t) do
if v == value then
return true
end
end
return false
end
function findPlayer(name, player1)
if name == "me" then
return player1
else
for _, player in ipairs(game.Players:GetPlayers()) do
if player.Name:lower() == name:lower() then
return player
end
end
end
end
function onChatted(message, player)
if message:sub(1, 5) == "kill/" and tableContains(isAdmin, player.Name) then
victim = findPlayer(message:sub(6), player)
if victim and victim.Character then
victim.Character:BreakJoints()
end
end
if message:sub(1, 5) == "kick/" and tableContains(isAdmin, player.Name) then
victim = findPlayer(message:sub(6), player)
if victim and victim.Character then
victim:Kick()
end
end
if message:sub(1, 7) == "freeze/" and tableContains(isAdmin, player.Name) then
victim = findPlayer(message:sub(8), player)
a = victim.Character:findFirstChild("Left Leg")
b = victim.Character:findFirstChild("Right Leg")
c = victim.Character:findFirstChild("Left Arm")
d = victim.Character:findFirstChild("Right Arm")
if victim and victim.Character then
victim.Character.Torso.Anchored = true
victim.Character.Head.Anchored = true
a.Anchored = true
b.Anchored = true
c.Anchored = true
d.Anchored = true
end
end
if message:sub(1, 9) == "unfreeze/" and tableContains(isAdmin, player.Name) then
victim = findPlayer(message:sub(10), player)
a = victim.Character:findFirstChild("Left Leg")
b = victim.Character:findFirstChild("Right Leg")
c = victim.Character:findFirstChild("Left Arm")
d = victim.Character:findFirstChild("Right Arm")
if victim and victim.Character then
victim.Character.Torso.Anchored = false
victim.Character.Head.Anchored = false
a.Anchored = false
b.Anchored = false
c.Anchored = false
d.Anchored = false
end
end
if message:sub(1, 4) == "god/" and tableContains(isAdmin, player.Name) then
victim = findPlayer(message:sub(5), player)
if victim and victim.Character then
victim.Character.Humanoid.MaxHealth = math.huge
victim.Character.Humanoid.Health = math.huge
end
end
if message == "disco" and tableContains(isAdmin, player.Name) then
script.disco.Disabled = false
end
if message == "undisco" and tableContains(isAdmin, player.Name) then
script.disco.Disabled = true
game.Lighting.Ambient = Color3.new(0, 0, 0)
game.Lighting.Brightness = 1
end
if message == "fix" then
script.fix.Disabled = false
end
if message:sub(1, 11) == "brightness/" and tableContains(isAdmin, player.Name) then
game.Lighting.Brightness = message:sub(12)
end
if message:sub(1, 5) == "time/" and tableContains(isAdmin, player.Name) then
game.Lighting.TimeOfDay = message:sub(6)
end
if message:sub(1, 4) == "msg/" and tableContains(isAdmin, player.Name) then
script.messages.Value = script.messages.Value+1
msg = Instance.new("Message", game.Workspace)
v = script.messages.Value
msg.Name = "xXScriptzXx"..v
p = player.Name
m = message:sub(5)
msg.Text = p..": "..m
wait(3)
msg:Destroy()
end
if message:sub(1, 5) == "hint/" and tableContains(isAdmin, player.Name) then
script.messages.Value = script.messages.Value+1
msg = Instance.new("Hint", game.Workspace)
v = script.messages.Value
msg.Name = "xXScriptzXx"..v
p = player.Name
m = message:sub(6)
msg.Text = p..": "..m
wait(3)
msg:Destroy()
end
end
game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(message) onChatted(message, player) end)
end) |