Points as value in my game

Hi guys,so I know that you can insert a script in the serverscriptservice that give the possibility to give a player a certain amount of points when they do something or touch a part.
Is possible to use this points as a value in the game to buy gears ?

For sure this can easily be achieved! You can load an IntValue or NumberValue Object to the player when the player joins than create a script that checks if they have enough “points” to be able to purchase the item than when they touch the part you could do something like.

part.Touched:connect(function(plr)
	if plr.Parent:FindFirstChild("LowerTorso") then
		if game.Players[plr.Parent.Name] then
			if game.Players[plr.Parent.Name].Money.Value >= itemCost then
				game.Players[plr.Parent.Name].Money.Value = game.Players[plr.Parent.Name].Money.Value - itemCost
			end
		end
	end
end)

Good Luck!

1 Like

for “touching item”,you mean a player touching the item on a giver or in a GUI?

well you could also just change what I wrote for you and make it so it adds rather than subtracts the money value. The example I gave is if A player touched A part and wanted to purchase that specific item. However you could have it when they touch the part money is added.

1 Like

Ok thank you,if I want players to buy a gear in an item giver,I have to insert the script inside the giver and then give it a cost?

There are many ways you can do this. But yes you can just put that script inside of a part and than just assign the cost value to the part. Just mess around with it and experiment and you’ll figure it out.

1 Like