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

How would I make max Y scale equal 1?

I am trying to figure out a script that will make the max size for y scale, 1? For example if my item value is 1000 and it divides by 100, if it equals 10, it will automatically equal 1. Sorry if I didn't explain right! Please help!

--player
	local player = game.Players.LocalPlayer
	local lstat = player:WaitForChild("leaderstats")
	local stat = player:WaitForChild("stats")
	local doritos = lstat:WaitForChild("Doritos")
	local perclick = stat:WaitForChild("Per Click")
	--item
	local click1 = stat:WaitForChild("Click 1")
	--fake item
	local item = script.Parent.Parent:WaitForChild("Info")
	local owned = item:WaitForChild("Owned")
	local reward = item:WaitForChild("Reward")
	local origcost = item:WaitForChild("Orig")
	
while true do
	wait()
	script.Parent.Parent.Upgrade["1"].Owned:TweenSizeAndPosition(UDim2.new(1,0,owned.Value / 100,0), UDim2.new(0,0,1 - (owned.Value / 100),0), "Out", "Quad", .5)
	script.Parent.Parent.Upgrade["2"].Owned:TweenSizeAndPosition(UDim2.new(1,0,owned.Value / 200,0), UDim2.new(0,0,1 - (owned.Value / 200),0), "Out", "Quad", .5)
	script.Parent.Parent.Upgrade["3"].Owned:TweenSizeAndPosition(UDim2.new(1,0,owned.Value / 300,0), UDim2.new(0,0,1 - (owned.Value / 300),0), "Out", "Quad", .5)
	script.Parent.Parent.Upgrade["4"].Owned:TweenSizeAndPosition(UDim2.new(1,0,owned.Value / 400,0), UDim2.new(0,0,1 - (owned.Value / 400),0), "Out", "Quad", .5)
	script.Parent.Parent.Upgrade["5"].Owned:TweenSizeAndPosition(UDim2.new(1,0,owned.Value / 500,0), UDim2.new(0,0,1 - (owned.Value / 500),0), "Out", "Quad", .5)
	script.Parent.Parent.Upgrade["6"].Owned:TweenSizeAndPosition(UDim2.new(1,0,owned.Value / 600,0), UDim2.new(0,0,1 - (owned.Value / 600),0), "Out", "Quad", .5)
	script.Parent.Parent.Upgrade["7"].Owned:TweenSizeAndPosition(UDim2.new(1,0,owned.Value / 700,0), UDim2.new(0,0,1 - (owned.Value / 700),0), "Out", "Quad", .5)
	script.Parent.Parent.Upgrade["8"].Owned:TweenSizeAndPosition(UDim2.new(1,0,owned.Value / 800,0), UDim2.new(0,0,1 - (owned.Value / 800),0), "Out", "Quad", .5)
	script.Parent.Parent.Upgrade["9"].Owned:TweenSizeAndPosition(UDim2.new(1,0,owned.Value / 900,0), UDim2.new(0,0,1 - (owned.Value / 900),0), "Out", "Quad", .5)
	script.Parent.Parent.Upgrade["10"].Owned:TweenSizeAndPosition(UDim2.new(1,0,owned.Value / 1000,0), UDim2.new(0,0,1 - (owned.Value / 1000),0), "Out", "Quad", .5)
	if owned.Value >= 1000 then
		script.Parent.Parent.Info.Multiplier.Value = 6
	elseif owned.Value >= 900 then
		script.Parent.Parent.Info.Multiplier.Value = 5.5
	elseif owned.Value >= 800 then
		script.Parent.Parent.Info.Multiplier.Value = 5
	elseif owned.Value >= 700 then
		script.Parent.Parent.Info.Multiplier.Value = 4.5
	elseif owned.Value >= 600 then
		script.Parent.Parent.Info.Multiplier.Value = 4
	elseif owned.Value >= 500 then
		script.Parent.Parent.Info.Multiplier.Value = 3.5
	elseif owned.Value >= 400 then
		script.Parent.Parent.Info.Multiplier.Value = 3
	elseif owned.Value >= 300 then
		script.Parent.Parent.Info.Multiplier.Value = 2.5
	elseif owned.Value >= 200 then
		script.Parent.Parent.Info.Multiplier.Value = 2
	elseif owned.Value >= 100 then
		script.Parent.Parent.Info.Multiplier.Value = 1.5
	end
end

1 answer

You are looking for math.min. ex, value = math.min(1, 1000/100) will set value to 1 instead of 10.

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