DeVinci
|
  |
| Joined: 21 Jul 2010 |
| Total Posts: 338 |
|
|
| 30 Apr 2012 10:06 PM |
I've never ever worked with UDim2 so I'm not sure if this is correct.
expbar = script.Parent.EXPBar.Size template = script.Parent.EXPTemplate.Size exp = script.Parent.EXP.Value -- an Int value for the current exp out of the max -- blah blah, coding.... expbar = UDim2.new(math.ceil(template/exp*100), 0, 0.2, 0)
Would that last line work? I don't want to script my enemies to test it just yet. |
|
|
| Report Abuse |
|
|
pwnedu46
|
  |
| Joined: 23 May 2009 |
| Total Posts: 7534 |
|
|
| 30 Apr 2012 10:26 PM |
| You can't assign a property to a variable. Otherwise, it is correct. |
|
|
| Report Abuse |
|
|
DeVinci
|
  |
| Joined: 21 Jul 2010 |
| Total Posts: 338 |
|
|
| 01 May 2012 06:40 AM |
But the variable equals something that has a value.
But, I guess i could just make it longer and say
script.Parent.EXPBar.Size = UDim2(code, #,#)
Right? |
|
|
| Report Abuse |
|
|
DeVinci
|
  |
| Joined: 21 Jul 2010 |
| Total Posts: 338 |
|
| |
|
SDuke524
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 6267 |
|
|
| 01 May 2012 04:34 PM |
| What you're looking for is `exp/MaxExp`. That will give you the Scale you need. |
|
|
| Report Abuse |
|
|
DeVinci
|
  |
| Joined: 21 Jul 2010 |
| Total Posts: 338 |
|
|
| 01 May 2012 04:39 PM |
It didnt work. :\ Heres the output:
Players.DeVinci.PlayerGui.Class Gui.Frame.Main.Class1.Frame:18: attempt to perform arithmetic on global 'template' (a userdata value) |
|
|
| Report Abuse |
|
|
SDuke524
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 6267 |
|
|
| 01 May 2012 04:46 PM |
| Because template isn't what I said. Template is a completely unrelated value. You want the amount of exp they have divided by the maximum amount they can get. Or the amount of exp it takes to get to the next level. |
|
|
| Report Abuse |
|
|
DeVinci
|
  |
| Joined: 21 Jul 2010 |
| Total Posts: 338 |
|
|
| 01 May 2012 04:51 PM |
Ok, I used that method and got this output:
Players.DeVinci.PlayerGui.Class Gui.Frame.Main.Class1.Frame:18: attempt to call global 'UDim2' (a table value) |
|
|
| Report Abuse |
|
|
DeVinci
|
  |
| Joined: 21 Jul 2010 |
| Total Posts: 338 |
|
|
| 01 May 2012 04:58 PM |
And template IS a related value, because its the background of the EXP bar.
I want the end of the expbar to match the end of the template when the exp is capped. |
|
|
| Report Abuse |
|
|
SDuke524
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 6267 |
|
|
| 01 May 2012 05:12 PM |
| IF the expbar is inside the template then it'll match perfectly. Also check to make sure you didn't reassign UDim2 anywhere in your script. |
|
|
| Report Abuse |
|
|
DeVinci
|
  |
| Joined: 21 Jul 2010 |
| Total Posts: 338 |
|
|
| 01 May 2012 05:26 PM |
Ok, So I put the EXP Bar in the template. Heres the script:
exp = script.Parent.Exp.Value expm = script.Parent.ExpMax.Value level = script.Parent.Level.Value bar = script.Parent.EXPTemplate.EXPBar.Size levelup = true
while true do if exp == expm and levelup == true then level = level +1 exp = 0 expm = expm * 2 elseif level == 10 then levelup = false exp = expm end script.Parent.EXPTemplate.Text = exp.. "/" ..expm script.Parent.LevelText.Text = "Level: "..script.Parent.Level.Value bar = UDim2(math.ceil(exp/expm), 0, 1, 0) wait() end |
|
|
| Report Abuse |
|
|
DeVinci
|
  |
| Joined: 21 Jul 2010 |
| Total Posts: 338 |
|
|
| 01 May 2012 05:29 PM |
Realized one problem:
bar = UDim2(math.ceil(exp/expm), 0, 1, 0)
But theres no output and the script won't work. |
|
|
| Report Abuse |
|
|
DeVinci
|
  |
| Joined: 21 Jul 2010 |
| Total Posts: 338 |
|
|
| 01 May 2012 05:29 PM |
| bar = UDim2.new(math.ceil(exp/expm), 0, 1, 0) is what I meant |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
|
| 01 May 2012 06:08 PM |
| can you help me script? ive read a lot and still dont quite get how to make a plane |
|
|
| Report Abuse |
|
|
|
| 01 May 2012 06:09 PM |
| or make blocks follow pepole or be deadly |
|
|
| Report Abuse |
|
|
DeVinci
|
  |
| Joined: 21 Jul 2010 |
| Total Posts: 338 |
|
|
| 01 May 2012 06:14 PM |
Dont interupt my thread. This is serious stuff. Post one yourself.
Ok, So how would I frix that issue? |
|
|
| Report Abuse |
|
|
DeVinci
|
  |
| Joined: 21 Jul 2010 |
| Total Posts: 338 |
|
| |
|
DeVinci
|
  |
| Joined: 21 Jul 2010 |
| Total Posts: 338 |
|
| |
|
DeVinci
|
  |
| Joined: 21 Jul 2010 |
| Total Posts: 338 |
|
| |
|