Roblox Central

Discussion for all things Roblox. (roblox.com)

Welcome to the new forum! Any suggestions you have are greatly appreciated.
WARNING: Before referring anyone to this website, Please read this topic

    I see nothing wrong.

    Share
    avatar
    iMathRandom
    Mod

    Posts : 66
    Join date : 2009-06-21
    Location : Ohio

    I see nothing wrong.

    Post by iMathRandom on Mon Sep 28, 2009 7:22 am

    e gives it's values to Exp if AwardExp is true, but it doesn't work.


    Code:

    while (AwardExp) and e.Value>0 do
    wait(.01)
    Texp.Value=Texp.Value+1
    Exp.Value=Exp.Value+1
    e.Value=e.Value-1
    end

    if Exp.Value==ToNextLevel.Value then
    AwardExp = false
    Exp.Value=0
    if lvl.Value<=10 then
    lvl.Value=lvl.Value+1
    MaxHP.Value=MaxHP.Value+math.random(1, 8)
    stg.Value=stg.Value+math.random(1, 5)
    def.Value=def.Value+math.random(1, 5)
    spd.Value=spd.Value+math.random(1, 5)
    mag.Value=mag.Value+math.random(1, 5)
    elseif lvl.Value<= 11 and lvl.Value>=30 then
    lvl.Value=lvl.Value+1
    MaxHP.Value=MaxHP.Value+math.random(1, 6)
    stg.Value=stg.Value+math.random(1, 3)
    def.Value=def.Value+math.random(1, 3)
    spd.Value=spd.Value+math.random(1, 3)
    mag.Value=mag.Value+math.random(1, 3)
    else
    lvl.Value=lvl.Value+1
    MaxHP.Value=MaxHP.Value+math.random(1, 4)
    stg.Value=stg.Value+math.random(1, 2)
    def.Value=def.Value+math.random(1, 2)
    spd.Value=spd.Value+math.random(1, 2)
    mag.Value=mag.Value+math.random(1, 2)
    end
    wait(2)
    AwardExp=true
    end


    _________________
    w00t!, first siggy
    avatar
    Earth
    Admin

    Posts : 402
    Join date : 2009-06-18
    Location : According to my IP address: Topeka, Kansas.

    Re: I see nothing wrong.

    Post by Earth on Mon Sep 28, 2009 4:44 pm

    What should this do.

    Jfeather
    Admin

    Posts : 232
    Join date : 2009-06-18
    Location : This Forum. Duh.

    Re: I see nothing wrong.

    Post by Jfeather on Tue Sep 29, 2009 5:41 am

    Move the end after the While True Do function to the very end of the script. There is nothing running the "If" function, if I'm thinking correctly right now.


    _________________


    Remember to link your RC profile to your Roblox profile. You can do this in the "Information" section of your profile.
    To find someone's Roblox profile, it is located under their "Contact" tab on their RC profile.
    avatar
    iMathRandom
    Mod

    Posts : 66
    Join date : 2009-06-21
    Location : Ohio

    Re: I see nothing wrong.

    Post by iMathRandom on Tue Sep 29, 2009 3:16 pm

    Earth wrote:What should this do.

    It's a leveling up system. I'm going to use a GUI for exp so you can see it go up. Once you level up, you get to see what stats went up (later)then resets the exp and continue to add the remainning exp. e is where exp points go. If e Has 1 or more values then it will add it' values to Exp.


    @JFeather, wouldn't when somebody levels up their stats will continue to go up?


    _________________
    w00t!, first siggy
    avatar
    Earth
    Admin

    Posts : 402
    Join date : 2009-06-18
    Location : According to my IP address: Topeka, Kansas.

    Re: I see nothing wrong.

    Post by Earth on Tue Sep 29, 2009 4:36 pm

    It looks to like it adds Xp as you live...
    avatar
    iMathRandom
    Mod

    Posts : 66
    Join date : 2009-06-21
    Location : Ohio

    Re: I see nothing wrong.

    Post by iMathRandom on Tue Sep 29, 2009 6:28 pm

    @ Jfeather, it didn't work, plus I made additions to it. Here's the full script now.

    Code:

    game.Players.ChildAdded:connect(function(p)


    --Stats, Materials, and other Values--


    stats=Instance.new"IntValue" stats.Parent=p stats.Name="Stats"
    lvl=Instance.new"IntValue" lvl.Parent=stats lvl.Name="Level" lvl.Value=1
    MaxHP=Instance.new"IntValue" MaxHP.Parent=stats MaxHP.Name="MaxHP" MaxHP.Value=100
    gold=Instance.new"IntValue" gold.Parent=stats gold.Name="Gold" gold.Value=0
    Texp=Instance.new"IntValue" Texp.Parent=stats Texp.Name="Total Experience" Texp.Value=0
    Exp=Instance.new"IntValue" Exp.Parent=stats Exp.Name="Experience" Exp.Value=0
       AwardExp=Instance.new"BoolValue" AwardExp.Parent=Exp AwardExp.Name="AwardExp"
       e=Instance.new"IntValue" e.Parent=stats e.Name="e" e.Value=0
    ToNextLevel=Instance.new"IntValue" ToNextLevel.Parent=stats ToNextLevel.Name="TNL" ToNextLevel.Value=100
    stg=Instance.new"IntValue" stg.Parent=stats stg.Name="Strenght" stg.Value=1
    def=Instance.new"IntValue" def.Parent=stats def.Name="Defence" def.Value=1
    mag=Instance.new"IntValue" mag.Parent=stats mag.Name="Magic" mag.Value=1
    mp=Instance.new"IntValue" mp.Parent=stats mp.Name="Magic Power" mp.Value=10


    HUWA=Instance.new"BoolValue" HUWA.Parent=p HUWA.Name="HUWA" --Has Underwater Abillities
    Drown=Instance.new"BoolValue" Drown.Parent=HUWA Drown.Name="Drown" Drown.Value=true


    --Spawing Points--


    s=Instance.new"Vector3Value" s.Parent=p s.Name="Spawn" s.Value=Vector3.new(37.5, 3, -7)
    p.Changed:connect(function(n)
    if (n=="Character") and p.Character~=nil then
    p.Character.Humanoid.WalkSpeed=0
    m=Instance.new"Message"
    m.Parent=p
    m.Text=[[Please select the "Game Tool".]]
    end
    end)


    --Award Experience & Leveling Up--


    if e.Value>0 then
    AwardExp.Value=true
    else
    AwardExp.Value=false
    end
    while (AwardExp.Value) do
    wait(.01)
    Texp.Value=Texp.Value+1
    Exp.Value=Exp.Value+1
    e.Value=e.Value-1
    end

    if Exp.Value==ToNextLevel.Value then
    AwardExp.Value=false
    Exp.Value=0
    if lvl.Value<=10 then
    lvl.Value=lvl.Value+1
    MaxHP.Value=MaxHP.Value+math.random(1, 8)
    stg.Value=stg.Value+math.random(1, 5)
    def.Value=def.Value+math.random(1, 5)
    spd.Value=spd.Value+math.random(1, 5)
    mag.Value=mag.Value+math.random(1, 5)
    elseif lvl.Value<= 11 and lvl.Value>=30 then
    lvl.Value=lvl.Value+1
    MaxHP.Value=MaxHP.Value+math.random(1, 6)
    stg.Value=stg.Value+math.random(1, 3)
    def.Value=def.Value+math.random(1, 3)
    spd.Value=spd.Value+math.random(1, 3)
    mag.Value=mag.Value+math.random(1, 3)
    else
    lvl.Value=lvl.Value+1
    MaxHP.Value=MaxHP.Value+math.random(1, 4)
    stg.Value=stg.Value+math.random(1, 2)
    def.Value=def.Value+math.random(1, 2)
    spd.Value=spd.Value+math.random(1, 2)
    mag.Value=mag.Value+math.random(1, 2)
    end
    wait(2)
    AwardExp.Value=true
    end




    end)


    _________________
    w00t!, first siggy
    avatar
    Meelo
    Admin

    Posts : 217
    Join date : 2009-06-19

    Re: I see nothing wrong.

    Post by Meelo on Tue Sep 29, 2009 7:05 pm

    Add to the start:

    script:Work()


    _________________
    Banhappy? BANHAPPY? I'LL SHOW YOU BANHAPPY!
    avatar
    Earth
    Admin

    Posts : 402
    Join date : 2009-06-18
    Location : According to my IP address: Topeka, Kansas.

    Re: I see nothing wrong.

    Post by Earth on Wed Sep 30, 2009 3:53 pm

    If only meelo... If only...
    avatar
    Meelo
    Admin

    Posts : 217
    Join date : 2009-06-19

    Re: I see nothing wrong.

    Post by Meelo on Wed Sep 30, 2009 4:54 pm

    Earth wrote:If only meelo... If only...
    It doesn't work? *Kicks 'Lua for Dummies'*


    _________________
    Banhappy? BANHAPPY? I'LL SHOW YOU BANHAPPY!
    avatar
    iMathRandom
    Mod

    Posts : 66
    Join date : 2009-06-21
    Location : Ohio

    Re: I see nothing wrong.

    Post by iMathRandom on Thu Oct 01, 2009 6:06 am

    I finallly figured it out.

    Code:

    while true do
    wait(0.000000000000000000001)

    if Exp.Value==ToNextLevel.Value then
    AwardExp = false
    ToNextLevel.Value=(ToNextLevel.Value*15/100) + ToNextLevel.Value
    Exp.Value=0
    if lvl.Value<=10 then
    lvl.Value=lvl.Value+1
    MaxHP.Value=MaxHP.Value+math.random(1, 8)
    stg.Value=stg.Value+math.random(1, 5)
    def.Value=def.Value+math.random(1, 5)
    mag.Value=mag.Value+math.random(1, 5)
    elseif lvl.Value<= 11 and lvl.Value>=30 then
    lvl.Value=lvl.Value+1
    MaxHP.Value=MaxHP.Value+math.random(1, 6)
    stg.Value=stg.Value+math.random(1, 3)
    def.Value=def.Value+math.random(1, 3)
    mag.Value=mag.Value+math.random(1, 3)
    else
    lvl.Value=lvl.Value+1
    MaxHP.Value=MaxHP.Value+math.random(1, 4)
    stg.Value=stg.Value+math.random(1, 2)
    def.Value=def.Value+math.random(1, 2)
    mag.Value=mag.Value+math.random(1, 2)
    end
    wait(2)
    AwardExp=true
    end
    if (AwardExp) and e.Value>0 then
    wait(.000000000001)
    Texp.Value=Texp.Value+1
    Exp.Value=Exp.Value+1
    e.Value=e.Value-1
    end
    end


    _________________
    w00t!, first siggy
    avatar
    Earth
    Admin

    Posts : 402
    Join date : 2009-06-18
    Location : According to my IP address: Topeka, Kansas.

    Re: I see nothing wrong.

    Post by Earth on Thu Oct 01, 2009 1:20 pm

    That wait is uglay.

    smallest wait is like 0.03 or something.
    avatar
    iMathRandom
    Mod

    Posts : 66
    Join date : 2009-06-21
    Location : Ohio

    Re: I see nothing wrong.

    Post by iMathRandom on Thu Oct 01, 2009 1:35 pm

    Earth wrote:That wait is uglay.

    smallest wait is like 0.03 or something.

    But it works so =P


    _________________
    w00t!, first siggy
    avatar
    iMathRandom
    Mod

    Posts : 66
    Join date : 2009-06-21
    Location : Ohio

    Re: I see nothing wrong.

    Post by iMathRandom on Thu Oct 01, 2009 1:35 pm

    Earth wrote:That wait is uglay.

    smallest wait is like 0.03 or something.

    But it works so =P


    _________________
    w00t!, first siggy

    Sponsored content

    Re: I see nothing wrong.

    Post by Sponsored content


      Current date/time is Mon Nov 12, 2018 3:40 pm