Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would I make a give points command?

Anyone know how I would do this? This is my script so far:

local Players = game:GetService("Players")
local Prefix = ":"
local GroupId = Int

Players.PlayerAdded:Connect(function(Player)
	if Player:GetRankInGroup(GroupId) >= Int then
		Player.Chatted:Connect(function(msg)
			if msg:Sub(1,11) == Prefix.."AddPoints " then
				local Target = Players:FindFirstChild(msg:Sub(12))
			end
		end)
	end
end)

1 answer

✓ Accepted answer

I know this is not in your script, but you could also use a function that allows you to shorten the chatted name of a player in the game. For example: (without function) ;kill KDarren12, (with function) ;kill KD.

function GetPlayer(targetedPlayerName)
      for _,player in pairs(game:GetService("Players"):GetPlayers()) do
	        if targetedPlayerName:lower() == player.Name:sub(1,targetedPlayerName:len()):lower() then
	            return player 
	        end
	    end
	    return nil 
end


local Prefix = ":"
local GroupId = Int

Players.PlayerAdded:Connect(function(Player)
    if Player:GetRankInGroup(GroupId) >= Int then
        Player.Chatted:Connect(function(msg)
            if msg:Sub(1,11) == Prefix.."AddPoints " then
                local Target = GetPlayer(msg:sub(12))
		   -- I do not know if they are leaderstats, but here:
		print("Added points to player "..Target)
            end
        end)
    end
end)

11 comments

0

Thx! I am going to learn from this script

0

No problem. I hope you can do something great, good luck!

0

but one question, I know that it can get the player but what if I wanted to do :AddPoints [Plr] and then the number

0

Do you want to do [number], [plr]?

0

better question, do you have leaderstats? And if so, what are they?

0

It is just Player.leaderstats.Points.Value

0

I'm nto sure how to do that. I've heard about string.split but have not learned how to use it. I'm so sorry if I couldn't fully answer your question.

0

it's good i fixed it now :)

0

alr good day

0

not relevant but i recognize you from void script builder

0

me or microsoft?

This discussion is preserved as it was. New answers, comments, and votes are closed.