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

How to make a ImageLabel move based on an IntValue?

Throw this localscript script inside an IntValue, the IntValue should be inside an ImageLabel.

For some reason, this script has no output error, and does not do as intended....

local dude = script.Parent

local diddly = dude.Parent

if dude.Value == 0 then
	diddly.Position = UDim2.new(0,0,0,0)
	

if dude.Value == 1 then
	diddly.Position = UDim2.new(0,-16,0,0)

if dude.Value == 2 then
	diddly.Position = UDim2.new(0,-33,0,0)	

if dude.Value == 3 then
	diddly.Position = UDim2.new(0,-50,0,0)

if dude.Value == 4 then
	diddly.Position = UDim2.new(0,-66,0,0)	

if dude.Value == 5 then
	diddly.Position = UDim2.new(0,-82,0,0)

if dude.Value == 6 then
	diddly.Position = UDim2.new(0,-99,0,0)	

if dude.Value == 7 then
	diddly.Position = UDim2.new(0,-116,0,0)

if dude.Value == 8 then
	diddly.Position = UDim2.new(0,-132,0,0)	
	
if dude.Value == 9 then
	diddly.Position = UDim2.new(0,-148,0,0)	

											
end
end
end
end
end
end
end
end
end
end

1 answer

  1. Is your hierarchy correct?

  2. Does the script run?

  3. Does it need to run more than once? Try a slow wait loop or connect it to dude.Changed.

  4. Why are you 'end's out of place?

  5. When there is a pattern, try to shorten your code:

local dude = script.Parent
local diddly = dude.Parent
local val = dude.Value

if val >=0 and val <=9 then
    diddly.Position = UDim2.new(0,val*(-148/9),0,0)
end

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