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

Why can't I subtract 10% from leaderstats?

I'm trying to print leaderstats.Current.Value - 0.1 but the only thing that prints is -0.1

local Players = game:GetService("Players")
local DataStore2 = require(game.ServerScriptService.DataStore:WaitForChild("MainModule"))

Players.PlayerAdded:Connect(function(player)
	print(player.Name .. " joined the game!")
	local PointsStore = DataStore2("Current", player)
	local Current = player.leaderstats:WaitForChild("Current").Value 
	Current = Current - 0.1
	print(Current)
	
end)

1 answer

✓ Accepted answer

Howdy!

Subtracting 0.1 from a number doesn't constitute 10%. If you want to subtract 10%, you might want to consider taking the original number and multiplying it by 0.9. This takes your number and makes it 90% of what it was originally.

##If this helped you out, consider accepting this answer for those sweet, sweet reputation points. If not, comment below and I (or someone else) will help you out.

##Be sure to check out the Roblox API Documentation as well for additional reference.

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