How to delete points when you added it?

So actually I watched a video from RoScripter “AddPoints” but I want to remove them tho actually how can I do that?

3 Likes

Can you show me your script please!?

2 Likes

Yeah sure here:

local GroupId = 10878583
local MinimumRankToUseCommand = 243

game.Players.PlayerAdded:Connect(function(Player)
if Player:GetRankInGroup(GroupId) >= MinimumRankToUseCommand then
Player.Chatted:Connect(function(Message)
local Words = string.split(Message, " ")

		if Words[1] == "!addpoint" then
			local NameOfPlayerToGivePoint = Words[2]
			local AmountOfPointsToGive = Words[3]
			
			local PlayerToGivePoint = game.Players:FindFirstChild(NameOfPlayerToGivePoint)
			
			if PlayerToGivePoint then
				PlayerToGivePoint.leaderstats.Points.Value = PlayerToGivePoint.leaderstats.Points.Value + AmountOfPointsToGive
			end
		end
	end)
end

end)

2 Likes

Add a new script to ServerScriptService

And put this inside the script:

local GroupId = 10878583
local MinimumRankToUseCommand = 243

game.Players.PlayerAdded:Connect(function(Player)
	if Player:GetRankInGroup(GroupId) >= MinimumRankToUseCommand then
		Player.Chatted:Connect(function(Message)
			local Words = string.split(Message, " ")

			if Words[1] == "!removepoint" then
				local NameOfPlayerToGivePoint = Words[2]
				local AmountOfPointsToGive = Words[3]

				local PlayerToGivePoint = game.Players:FindFirstChild(NameOfPlayerToGivePoint)

				if PlayerToGivePoint then
					PlayerToGivePoint.leaderstats.Points.Value = PlayerToGivePoint.leaderstats.Points.Value - AmountOfPointsToGive
				end
			end
		end)
	end
end)
1 Like

This will run anytime you say “!removepoint” and you have the right role in the group!

1 Like

Thanks it worked! Also i need to write the whole name of the person but i actually wanna write: ex. ‘rob’ and not ‘ROBLOX’ could you help me with that?

1 Like

This is a bit more challenging.

1 Like

If you give me a bit of time I will try to work it out, ok?

2 Likes

I think I may have found something!

Give me some time!

1 Like

Try this for the remove point system!

function FindPlayer(name) -- name = string provided to look for player
	for i,v in pairs(game.Players:GetPlayers()) do  -- iterating though players
		if v.Name:lower():sub(1,#name) == name:lower() then	-- checking to see if player name matches the provided string
			return v -- returns the player it finds
		end
	end
end


local GroupId = 10878583
local MinimumRankToUseCommand = 243

game.Players.PlayerAdded:Connect(function(Player)
	if Player:GetRankInGroup(GroupId) >= MinimumRankToUseCommand then
		Player.Chatted:Connect(function(Message)
			local Words = string.split(Message, " ")

			if Words[1] == "!removepoint" then
				local NameOfPlayerToGivePoint = Words[2]
				local AmountOfPointsToGive = Words[3]
				
				local PointsGiveToUser = FindPlayer(NameOfPlayerToGivePoint)

				local PlayerToGivePoint = game.Players:FindFirstChild(PointsGiveToUser)

				if PlayerToGivePoint then
					PlayerToGivePoint.leaderstats.Points.Value = PlayerToGivePoint.leaderstats.Points.Value - AmountOfPointsToGive
				end
			end
		end)
	end
end)
1 Like

I put the script in but it didnt work…

1 Like

Can you show me the output please?

1 Like

Try this for the RemovePoint script again:

local GroupId = 10878583
local MinimumRankToUseCommand = 243

game.Players.PlayerAdded:Connect(function(Player)
	if Player:GetRankInGroup(GroupId) >= MinimumRankToUseCommand then
		Player.Chatted:Connect(function(Message)
			local Words = string.split(Message, " ")
			if Words[1] == "!removepoint" then
				print("Ok!")
				local NameOfPlayerToGivePoint = Words[2]
				local AmountOfPointsToGive = Words[3]

				for i,v in pairs(game.Players:GetPlayers()) do  -- iterating though players
					if v.Name:lower():sub(1,#NameOfPlayerToGivePoint) == NameOfPlayerToGivePoint:lower() then	-- checking to see if player name matches the provided string
						PointsGiveToUser = v
					end
				end
				
				local PlayerToGivePoint = game.Players:FindFirstChild(PointsGiveToUser)

				if PlayerToGivePoint then
					print("Worked!")
					PlayerToGivePoint.leaderstats.Points.Value = PlayerToGivePoint.leaderstats.Points.Value - AmountOfPointsToGive
				end
			end
		end)
	end
end)
1 Like

It doesnt work but this stand on the output

image

1 Like

WAIT!

I HAD A BRAIN SPARK :sparkles:

I KNOW!

1 Like

Wait I didn’t. ;-; I need to think…

I think I’m onto it ttho…

1 Like

nvm! I dont need it, its alright like this thanks!

how can i make a groupnametag? above you head because i watched RoScripters Video but it didnt work, It worked but only for me… Could you help me?

1 Like

Sure!

Make a new topic tho.

1 Like

This topic was automatically closed after 7 days. New replies are no longer allowed.