Hello,
So I am trying to create a point system so when you use a command you can give someone one point. Here is my script below if anyone could help. I am also not sure what value to use as I want there to be text and numbers on the same value (0 = trainee N/A = MR+).
game.Players.PlayerAdded:Connect(function(plr)
local Leaderstats = Instance.new("Folder", plr)
Leaderstats.Name = "leaderstats"
points = Instance.new("StringValue", Leaderstats)
points.Name = "Points"
local rank = Instance.new("StringValue", Leaderstats)
rank.Name = "Lighthouse Rank"
rank.Value = plr:GetRoleInGroup (6559630)
if plr:GetRankInGroup (6559630) == 5 then
points.Value = 0
elseif plr:GetRankInGroup (6559630) == 255 and 254 then
points.Value = "N/A"
end
end)
local commands = {}
local prefix = "!"
local player = game.Players
local function findPlayer(name)
for i, player in pairs(game.Players:GetPlayers()) do
if string.lower(player.Name) == name then
return player
end
end
return nil
end
commands.test = function(sender, args)
for i,playerName in pairs(args)do
print(playerName)
end
local playertogivepoints = args[1]
if playertogivepoints then
local plrtogive = findPlayer(playertogivepoints)
if plrtogive then
points = points + 1
end
end
end
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message,recipient)
message = string.lower(message)
local splitstring = message:split(" ")
local slashcommand = splitstring[1]
local cmd = slashcommand:split(prefix)
local cmdName = cmd[2]
if commands [cmdName] then
local args = {}
for i = 2, #splitstring, 1 do
table.insert(args, splitstring[i])
end
commands[cmdName](player, args)
end
end)
end)