What do you want to achieve? I’m trying to make a script to scale an ImageLabel based off of an intvalue
What is the issue? It just won’t scale here is a video
What solutions have you tried so far? I looked on the dev forum and couldn’t find anything that helps.
My script is a normal script and is located in StarterPlayer.StarterCharacterScripts
Here is my script
while true do
if script.Parent.Parent.Parent.InfectionStuff.InfectedHealth.Value == 91 or 92 or 93 or 94 or 95 or 96 or 97 or 98 or 99 or 100 then
script.Parent.Frame.IFHB.Size = UDim2.new(1,0,.9,0)
elseif script.Parent.Parent.Parent.InfectionStuff.InfectedHealth.Value == 81 or 82 or 83 or 84 or 85 or 86 or 87 or 88 or 89 or 90 then
script.Parent.Frame.IFHB.Size = UDim2.new(.9,0,.9,0)
elseif script.Parent.Parent.Parent.InfectionStuff.InfectedHealth.Value == 71 or 72 or 73 or 74 or 75 or 76 or 77 or 78 or 79 or 80 then
script.Parent.Frame.IFHB.Size = UDim2.new(.8,0,.9,0)
elseif script.Parent.Parent.Parent.InfectionStuff.InfectedHealth.Value == 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70 then
script.Parent.Frame.IFHB.Size = UDim2.new(.7,0,.9,0)
elseif script.Parent.Parent.Parent.InfectionStuff.InfectedHealth.Value == 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 then
script.Parent.Frame.IFHB.Size = UDim2.new(.6,0,.9,0)
elseif script.Parent.Parent.Parent.InfectionStuff.InfectedHealth.Value == 41 or 42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 then
script.Parent.Frame.IFHB.Size = UDim2.new(.5,0,.9,0)
elseif script.Parent.Parent.Parent.InfectionStuff.InfectedHealth.Value == 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 then
script.Parent.Frame.IFHB.Size = UDim2.new(.4,0,.9,0)
elseif script.Parent.Parent.Parent.InfectionStuff.InfectedHealth.Value == 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 then
script.Parent.Frame.IFHB.Size = UDim2.new(.3,0,.9,0)
elseif script.Parent.Parent.Parent.InfectionStuff.InfectedHealth.Value == 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 then
script.Parent.Frame.IFHB.Size = UDim2.new(.2,0,.9,0)
elseif script.Parent.Parent.Parent.InfectionStuff.InfectedHealth.Value == 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 then
script.Parent.Frame.IFHB.Size = UDim2.new(.1,0,.9,0)
end
wait()
end
I would prefer if you would tell me the part that is wrong with my script.
Also I’m sorry if this is the wrong place for this
while wait() do
local LABEL = script.Parent.Frame.IFHB
local INFECTED_HEALTH = script.Parent.Parent.Parent.InfectionStuff.InfectedHealth
LABEL.Size = UDim2.new(INFECTED_HEALTH.Value / 100, 0, .9, 0)
end
local InfectionHealth = script.Parent.Parent.Parent.InfectionStuff.InfectedHealth
local Gui = script.Parent.Frame.IFHB
local function onInfectionHealthChanged()
Gui:TweenSize(Udim2.new(InfectionHealth.Value/100 0, 0.9,0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, 0.4, false)
end
InfectionHealth:GetPropertyChangedSignal("Value"):Connect(onInfectionHealthChanged)
onInfectionHealthChanged()
local InfectionHealth = script.Parent.Parent.Parent.InfectionStuff.InfectedHealth
local Gui = script.Parent.Frame.IFHB
local function onInfectionHealthChanged()
Gui:TweenSize(UDim2.new(InfectionHealth.Value/100 ,0, 0.9,0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, 0.4, false)
end
InfectionHealth:GetPropertyChangedSignal("Value"):Connect(onInfectionHealthChanged)
onInfectionHealthChanged()
local debounce = false
script.Parent.Touched:Connect(function(obj)
if debounce == false then
debounce = true
local h = obj.Parent:FindFirstChild("Humanoid")
if h then
h.Parent.InfectionStuff.InfectedHealth.Value -= 38
end
wait(5)
debounce = false
end
end)
Not sure, but this might just be very simple. You would decrease the 2nd number of the X axis of the Size of the ImageLabel (It will depend, assuming it is decreasing it to the left, then this is correct.)
local InfectionHealth = script.Parent.Parent.Parent.InfectionStuff.InfectedHealth
local Gui = script.Parent.Frame.IFHB
local function onInfectionHealthChanged()
Gui.Size = Udim2.new(InfectionHealth.Value/100, 0, 0.9,0)
end
onInfectionHealthChanged()
InfectionHealth:GetPropertyChangedSignal("Value"):Connect(onInfectionHealthChanged)