#Is bot still in construction?

1 messages · Page 1 of 1 (latest)

harsh moat
#

The bot can't write full script for my things..
"Roblox Lua"

local MIN_WARN_RANK = 250
local MIN_CLEAR_RANK = 253

-- Create a map to store warning data for each player
local warningData = {}

-- Create a function to handle the !warn command
local function onWarnCommand(player, targetPlayer, reason)
  -- Check if the player has the required rank to issue a warning
  if player:GetRankInGroup(game.Players.LocalPlayer.GroupId) < MIN_WARN_RANK then
    player:SendSystemMessage("You do not have permission to use the !warn command.")
    return
  end

  -- Check if the player is trying to warn themselves
  if player == targetPlayer then
    player:SendSystemMessage("You cannot warn yourself.")
    return
  end

  -- Get the warning data for the target player
  local data = warningData[targetPlayer.UserId]
  if not data then
    -- This is the player's first warning, so create a new warning data entry
    data = {
      warnings = 1,
      reasons = {reason}
    }
    warningData[targetPlayer.UserId] = data
  else
    -- Increment the warning count and add the new reason to the list
    data.warnings = data.warnings + 1
    table.insert(data.reasons, reason)
  end

  -- Check if the player has reached the warning limit
  if data.warnings >= 3 then
    -- Kick the player from the game
    targetPlayer:Kick("You have been kicked for receiving 3 warnings.")
  else
    -- Display a warning message above the player's head
    local message = "Warning " .. data.warnings .. " - " .. reason
    targetPlayer:SetSpecialPersistence(true)
    targetPlayer.Character.Head.NameLabel.Text = message
    wait(300)
    targetPlayer.Character.Head.NameLabel.Text = ""
    targetPlayer:SetSpecialPersistence(false)
  end
end

-- Create a function to handle the !clearwarns command
local function onClearWarnsCommand(player, targetPlayer)
  -- Check if the player has the required rank to clear warnings
  if player:GetRankInGroup(game.Players.LocalPlayer.GroupId) < MIN_CLEAR_RANK then
    player:SendSystemMessage("You do not have permission to use the !clearwarns command.")
    return
  end

  -- Clear the warning data for the target player
  warningData[targetPlayer.UserId] = nil
  player:SendSystemMessage("The warnings for the player have been cleared.")
end

-- Connect the command functions to the corresponding chat commands
game.Players.PlayerAdded:Connect(function(player)
  player.Chatted:Connect(function(message)
    -- Split the message into words
    local words = {}
    for word in message:gmatch("%w+") do
      table.insert(words, word)
    end

    -- Check if the first word is a command
    if words[1] == "!warn" then
      -- Find the target player by their name (partial name is allowed)
      local targetPlayer = nil
      for _,p in pairs(game.Players:GetPlayers())```

Is the script full?