|
| 07 May 2013 09:23 PM |
I have a series of equations set up in the script, and I need a specific value named 'sizB' as the second term in UDim2.new(0,0,0,0). However, whn I input the name there, it sets it to 0, how do put the sizB part in the UDim2 set? |
|
|
| Report Abuse |
|
|
|
| 07 May 2013 09:31 PM |
What is sizB equal too?
UDim2.new (0, sizB, 0, 0)
Something like this? |
|
|
| Report Abuse |
|
|
|
| 07 May 2013 09:35 PM |
Yes. sizB = LvWildCURHP*sizA
sizA = 200/LvWildMAXHP
LvWildCURHP = script.Parent.Parent.Parent.Bar.HP_Meter.HPC_Value.Value
LvWildMAXHP = script.Parent.Parent.Parent.Bar.HP_Meter.HPM_Value.Value
Both CURHP and MAXHP are specific IntValues |
|
|
| Report Abuse |
|
|
|
| 07 May 2013 09:37 PM |
| sizB must be after sizA because sizA isn't defined until after sizB is defined. |
|
|
| Report Abuse |
|
|
|
| 07 May 2013 09:42 PM |
| and LvWILDMAXHP and the other variable must be before sizB |
|
|
| Report Abuse |
|
|
|
| 07 May 2013 09:43 PM |
Well, they were posted backwards...but they're in this order:
LvWildCURHP LvWildMAXHP sizA sizB
This is the script without the references at the top;
while wait() do script.Parent.Parent.Parent.Bar.HP_Meter.Size = UDim2.new(0, sizB, 0, 10) end LvWildCURHP.Changed:connect(function(check) if LvWildCURHP > LvWildMAXHP then wait() LvWildCURHP = LvWildMAXHP end end) |
|
|
| Report Abuse |
|
|
|
| 07 May 2013 09:44 PM |
| If they are values, then you need to put "sizB.Value". |
|
|
| Report Abuse |
|
|
|
| 07 May 2013 09:46 PM |
So it should actually be;
LvWildCURHP = script.Parent.Parent.Parent.Bar.HP_Meter.HPC_Value.Value
LvWildMAXHP = script.Parent.Parent.Parent.Bar.HP_Meter.HPM_Value.Value
sizA = 200/LvWildMAXHP.Value
sizB = LvWildCURHP.Value*sizA.Value
|
|
|
| Report Abuse |
|
|
|
| 07 May 2013 09:46 PM |
And then;
script.Parent.Parent.Parent.Bar.HP_Meter.Size = UDim2.new(0, sizB.Value, 0, 10) |
|
|
| Report Abuse |
|
|
|
| 07 May 2013 09:48 PM |
Sorry, Ineeded to fix this, but it should look like such?
LvWildCURHP = script.Parent.Parent.Parent.Bar.HP_Meter.HPC_Value.Value LvWildMAXHP = script.Parent.Parent.Parent.Bar.HP_Meter.HPM_Value.Value sizA = 200/LvWildMAXHP sizB = LvWildCURHP*sizA.Value
script.Parent.Parent.Parent.Bar.HP_Meter.Size = UDim2.new(0, sizB.Value, 0, 10)
|
|
|
| Report Abuse |
|
|
|
| 07 May 2013 09:49 PM |
| Aside from un necasary parents. Yes. That looks good. |
|
|
| Report Abuse |
|
|
|
| 07 May 2013 09:50 PM |
| What do you mean about the parents? |
|
|
| Report Abuse |
|
|
|
| 07 May 2013 09:52 PM |
| Actually, I am seeing problems. You're adding properties to Variables. You can't do that. |
|
|
| Report Abuse |
|
|
|
| 07 May 2013 09:53 PM |
| I noticed it a second ago xD |
|
|
| Report Abuse |
|
|
|
| 07 May 2013 09:55 PM |
| So what would it look like then? o.o |
|
|
| Report Abuse |
|
|
|
| 07 May 2013 09:55 PM |
| Post you're new Variables. |
|
|
| Report Abuse |
|
|
|
| 07 May 2013 09:55 PM |
| Can I have the entire script? |
|
|
| Report Abuse |
|
|
|
| 07 May 2013 09:56 PM |
The variables didn't change since doing anything would be trying to make the script find nil properties..
LvWildCURHP = script.Parent.Parent.Parent.Bar.HP_Meter.HPC_Value.Value LvWildMAXHP = script.Parent.Parent.Parent.Bar.HP_Meter.HPM_Value.Value sizA = (200/LvWildMAXHP) sizB = (LvWildCURHP*sizA) |
|
|
| Report Abuse |
|
|
|
| 07 May 2013 09:58 PM |
This is the entire script:
LvWildCURHP = script.Parent.Parent.Parent.Bar.HP_Meter.HPC_Value.Value LvWildMAXHP = script.Parent.Parent.Parent.Bar.HP_Meter.HPM_Value.Value sizA = (200/LvWildMAXHP) sizB = (LvWildCURHP*sizA) while wait() do script.Parent.Parent.Parent.Bar.HP_Meter.Size = UDim2.new(0, sizB, 0, 10) end LvWildCURHP.Changed:connect(function(check) if LvWildCURHP > LvWildMAXHP then wait() LvWildCURHP = LvWildMAXHP end end) |
|
|
| Report Abuse |
|
|
|
| 07 May 2013 10:03 PM |
Meter = script.Parent.Parent.Parent.Bar.HP_Meter LvWildCURHP = Meter.HPC_Value LvWildMAXHP = Meter.HPM_Value sizA = (200/LvWildMAXHP.Value) sizB = (LvWildCURHP.Value*sizA)
while wait() do Meter.Size = UDim2.new(0, sizB, 0, 10) end
LvWildCURHP.Changed:connect(function(check) if LvWildCURHP.Value > LvWildMAXHP.Value then wait() LvWildCURHP.Value = LvWildMAXHP.Value end end)
--I editted it on my knowledge of your script. Not 100% sure if this is right, but I cleaned it up a bit. Gimmie an output if it doesn't work. |
|
|
| Report Abuse |
|
|
|
| 07 May 2013 10:10 PM |
| There was no difference between when I ran miine, and this one. |
|
|
| Report Abuse |
|
|
| |
|
|
| 07 May 2013 10:14 PM |
| No, where the sizB is, the UDim2 is just being set to 0. |
|
|
| Report Abuse |
|
|
| |
|
| |
|