thanks for all the help but nothing is working for me and i also accidently deleted another script and cant recover it while trying to fix this
Well uh my system i used was made in a localscript so i used a remoteevent to access the server
Welp, I recommend watching YT vids for itā¦
i spent over 4 hours on this alone
Well, Iām sorry that I could not helpā¦
is there any way to recover the script i accidently got rid off, control z does not work as i closed studio and re-opened it
Sorry, I am not sureā¦ I am so sorry thoā¦
1 Like
its alright, ill re-make the script i accidently got rid off
Here is the functional code I made, if anybody needs it as a reference:
local DataStoreService = game:GetService("DataStoreService")
local banStorage = DataStoreService:GetDataStore("BanStorage")
local ReasonStorage = DataStoreService:GetDataStore("ReasonStorage")
local message = game:GetService("MessagingService")
local admins = {"talis783"}
local commands = {"kick", "ban", "troll", "unban"}
local commandsFunction = {
["/troll"] = function(player, image)
for i,v in pairs(game:GetService("Players"):GetChildren()) do
if v.Name:lower() == player:lower() then
game.ReplicatedStorage.Troll:FireClient(v,image)
end
end
end,
["/kick"] = function(player, reason)
game.Players:FindFirstChild(player):Kick(reason)
end,
["/ban"] = function(player, reason)
local userId = game.Players:GetUserIdFromNameAsync(player)
if userId then
banStorage:SetAsync(userId, true)
local reasonString = Instance.new("StringValue")
reasonString.Value = reason
ReasonStorage:SetAsync(userId, {reasonString.Value})
if game.Players:FindFirstChild(player) then
game.Players:FindFirstChild(player):Kick(reason)
end
end
end,
["/unban"] = function(player, DontNeedThis)
local userId = game.Players:GetUserIdFromNameAsync(player)
if userId then
banStorage:SetAsync(userId, false)
end
end,
}
game.Players.PlayerAdded:Connect(function(plr)
local key = plr.UserId
local banData = banStorage:GetAsync(key)
if banData then
local reasonData = ReasonStorage:GetAsync(key)
local reason = reasonData[1]
print("player is banned")
task.wait(10)
if reason then
plr:Kick("You have been banned for reason: "..reason)
else
plr:Kick("You have been banned, no reason provided.")
end
end
end)
game.Players.PlayerAdded:Connect(function(plr)
if table.find(admins,plr.Name) then
print("Found plr in [admins] list")
plr.Chatted:Connect(function(plrmessage)
plrmessage = plrmessage:lower():split(" ")
for i = 1, #commands do
if plrmessage[1]:match(commands[i]) then
local func = commandsFunction[plrmessage[1]]
func(plrmessage[2], plrmessage[3])
end
end
end)
end
end)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.