Heres my script:
local gds = ds:GetDataStore("test")
local ts = game:GetService("TextService")
local prefix = "/"
function getPlayer(input)
input = string.lower(input)
for _, plr in pairs(game.Players:GetPlayers()) do
if string.find(string.lower(plr.Name),input) then
return plr
end
end
end
function filter(str,id)
return ts:FilterStringAsync(str,id):GetNonChatStringForBroadcastAsync()
end
do --commands
function kick(args)
kickMsg = "You have been kicked from the server by",args[0].Name.."."
getPlayer(args[2]):Kick(kickMsg)
end
function akick(args)
getPlayer(args[2]):Kick("You have been kicked from the server.")
end
end
local cmds = {
["kick"] = kick,
["akick"] = akick
}
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
--print(filter(msg,plr.UserId))
if string.sub(msg,1,1) == prefix then
msg = string.split(msg,prefix)[2]
local args = string.split(msg," ")
args[0] = plr
if true then--if table.find(cmds,args[1]) then
if args[1] == "kick" then kick(args) end
else
warn("command '"..args[1].."' does not exist!")
end
end
end)
end)```
it works fine except when i do /kick t instead of saying like you have been kicked by Tentoid, it just says you have been kicked by (and then nothing)
ive tried printing the kickmsg and it works as i wouldve expected it just doesnt work when i use it to actually kick.