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

How can I make it that you can convert 10 chips to 1 money?

script.Parent.DialogChoiceSelected:connect(function(player, choice)
	if (choice==script.Parent.TurnIn) then
		player.leaderstats.Money.Value=player.leaderstats.Money.Value+player.Chips.Value
		player.Chips.Value=0
	end
end)

If a player gets 10 chips, it can convert to 1 money. How can I make this work?

1 answer

if(choice==script.Parent.TurnIn) then for i = 0, 9 do if (player.Chips.Value-i) == 0 then player.leaderstats.Money.Value = player.leaderstats.Money.Value + (player.Chips.Value-i)/10 player.Chips.Value = player.Chips.Value-(player.Chips.Value-i) break end end end

3 comments

0

To elaborate on this (since I couldn't really include comments), it starts off by making a loop that subtracts 0-9 from whatever value your chips were at. It then checks to see if that value is divisible by 10, and if it is, it converts that portion to money, and keeps the rest as chips. For example, if you'd had 35 chips, you'd be left with 3 Money, and 5 chips.

0

Please put any scripts you post in a code block!

0

Sorry about that! I hadn't even known about code blocks 'til yesterday. I'm pretty dull, haha.

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