local banDS = game:GetService("DataStoreService"):GetDataStore("Bans")
local mods = {}
local admins = {476564429}
game:GetService("Players").PlayerAdded:Connect(function(plr)
local key = "-Banned" .. plr.UserId
local success, val = pcall(function()
return banDS:GetAsync(key)
end)
if(success) then
if(val) then
if(val[2] == true) then
plr:Kick("\n You have been permanently banned. \n Reason: \n" .. val[1])
end
end
else
print("error" .. plr.UserId .. " " .. plr.Name)
warn(val)
end
end)
game:GetService("ReplicatedStorage").WarnRequest.OnServerEvent:Connect(function(plr, reason)
local text = game.Players[plr].Character.Head.Overhead.Warnings.Text
local wrnings = game.Players[plr].Character.Head.Overhead.Warnings
local amt = game.Players[plr].Warnings
amt.Value = amt.Value + 1
text = "W" .. amt.Value .. " - " .. reason
if amt.Value >= 3 then
game.Players[plr]:Kick("You've reached the maximum number of warnings and have been kicked from the server.")
end
end)
game:GetService("ReplicatedStorage").BanRequest.OnServerEvent:Connect(function(mod, plr, reason)
if(table.find(mods, mod.UserId)) then
if not plr.UserId == admins then
local key = "-Banned" .. plr.UserId
local success, err = pcall(function()
banDS:SetAsync(key, {reason, true})
end)
plr:Kick("\n You have been permanently banned. \n Reason: \n" .. reason)
end
end
end)
game:GetService("ReplicatedStorage").UnbanRequest.OnServerEvent:Connect(function(mod, plr, reason)
if(table.find(mods, mod.UserId)) then
local key = "-Banned" .. plr.UserId
local success, err =pcall(function()
banDS:SetAsync(key, {reason, false})
end)
end
end)
game:GetService("ReplicatedStorage").KickRequest.OnServerEvent:Connect(function(mod, plr, reason)
if(table.find(mods, mod.UserId)) then
if not plr.UserId == admins then
plr:Kick("\n You are kicked from this server. \n Reason: \n " .. reason)
end
end
end)
Now, i got the attempt to concatenate string with Instance error on line 26. Script now:
local banDS = game:GetService("DataStoreService"):GetDataStore("Bans")
local mods = {}
local admins = {476564429}
game:GetService("Players").PlayerAdded:Connect(function(plr)
local key = "-Banned" .. plr.UserId
local success, val = pcall(function()
return banDS:GetAsync(key)
end)
if(success) then
if(val) then
if(val[2] == true) then
plr:Kick("\n You have been permanently banned. \n Reason: \n" .. val[1])
end
end
else
print("error" .. plr.UserId .. " " .. plr.Name)
warn(val)
end
end)
game:GetService("ReplicatedStorage").WarnRequest.OnServerEvent:Connect(function(plr, reason)
local text = plr.Character.Head.Overhead.Warnings.Text
local wrnings = plr.Character.Head.Overhead.Warnings
local amt = plr.Warnings
amt.Value = amt.Value + 1
text = "Warning " .. amt.Value .. ": Reason:" .. reason
if amt.Value >= 3 then
plr:Kick("You've reached the maximum number of warnings and have been kicked from the server.")
end
end)
game:GetService("ReplicatedStorage").BanRequest.OnServerEvent:Connect(function(mod, plr, reason)
if(table.find(mods, mod.UserId)) then
if not plr.UserId == admins then
local key = "-Banned" .. plr.UserId
local success, err = pcall(function()
banDS:SetAsync(key, {reason, true})
end)
plr:Kick("\n You have been permanently banned. \n Reason: \n" .. reason)
end
end
end)
game:GetService("ReplicatedStorage").UnbanRequest.OnServerEvent:Connect(function(mod, plr, reason)
if(table.find(mods, mod.UserId)) then
local key = "-Banned" .. plr.UserId
local success, err =pcall(function()
banDS:SetAsync(key, {reason, false})
end)
end
end)
game:GetService("ReplicatedStorage").KickRequest.OnServerEvent:Connect(function(mod, plr, reason)
if(table.find(mods, mod.UserId)) then
if not plr.UserId == admins then
plr:Kick("\n You are kicked from this server. \n Reason: \n " .. reason)
end
end
end)

1 comment
Because
game.Players[plr].Character.Head.Overhead.Warnings.Textis not a string but rather a Textbox or something. If you highlight it you'll see the properties in the properties tab, for example if it's a textbox you need a.Textat the end.