Numbers won't add

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I am attempting to add 0.06 to a gui’s Y scale when it’s cloned.
I’m not sure why, but the number just doesn’t change (I’ve tested with 4 different players and still the same result)

  1. What is the issue? Include screenshots / videos if possible!
    Like stated above the numbers wont add. Maybe there is an equation error but I thought I was doing it right. Maybe something changed

  2. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve printed what I wanted to happen but it dosen’t function in the script

here’s the script

local Players = game:GetService("Players")
local LbGui = game.ReplicatedStorage.Leaderboard
local pos = 0
local posnum = 0

Players.PlayerAdded:Connect(function(player)


	local userId = player.UserId
	local thumbType = Enum.ThumbnailType.HeadShot
	local thumbSize = Enum.ThumbnailSize.Size420x420
	local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)

local lbclone = LbGui.Mainframe.LeaderboardDisplay.Userinfobar:Clone()
	lbclone.Name = player.Name
	lbclone.NameLabel.Text = player.Name .. posnum
	print(player.Name)
	print(lbclone.NameLabel.Text)
	lbclone.ProfileImageLabel.Image = content
	lbclone.Parent = LbGui.Mainframe.LeaderboardDisplay
	lbclone.Position = UDim2.new(0,0,pos,0)
	lbclone.Visible = true
	local pos = pos + 0.06
	print(pos)
	print(pos + 0.06)
	local posnum = posnum + 1
	print(lbclone.Parent)
	
	
print("finished")

end)
1 Like

Try removing the 0 in 0.06 (so it would look like .06)? I don’t know what this would change, but it may make some difference. Add “prints” throughout your script (after you add), and print out the value, so you can see where you went wrong.

print(pos)

Is your script erroring? If so, could you provide a screenshot of your error?

1 Like

At the moment it is not erroring and I tried removing the 0 and it’s still the same issue. But I’ll definitely add prints so i can see if there’s anything unusual

  1. dont use local when you are updating an existing variable
  2. your increasing the size before you are increasing the numbers increase the numbers first

just do

    pos = pos + 0.06
	print(pos)
	print(pos + 0.06)
	posnum = posnum + 1
1 Like