Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help solve the problem of Obesity with scripting!?

Asked by 10 years ago

Helping me with this script will help me complete my game, which promotes fruit, which will help the problem of obesity!

This script is meant to: Load when picking a fruit; showing as a loading bar Once loaded give the fruit/ xp, etc...

This script works until the player lifts the button up. Then it still does done() and does it in the background until you try and pick another fruit where it gives you a load of fruit at the same time, then randomly gives you fruit...

Yeah, it's really messed up. I have no idea why could you help me make this place awesome? Credit will be given! :D

Place: http://www.roblox.com/Nature-V-0-02-place?id=139229308

local fruit, fruitTop, x, y, z, done = script.Parent, script.Parent.Fruit, false, true, true, false       
xpamount = 10 -- xpamount

script.Parent.ClickDetector.MouseClick:connect(function(plr)
if x == false then
    x = true

    barframe = plr.PlayerGui.ProgressBar.Frame
    bar = barframe.Bar
    pick = plr.PlayerGui.ProgressBar.Pick

    pick.Visible = true

    pick.MouseButton1Down:connect(function() -- Pick Button/ Progress bar animation
        if y == true then
            y = false
            barframe.Visible = true
            pick.Visible = true
            z = true
            while z == true and y == false do
                for size = 0,1,0.015 do
                    wait(0.03)
                    bar.Size = UDim2.new(size,0,1,0)
                    if z == false then
                        bar.Size = UDim2.new(0,0,1,0)
                        barframe.Visible = false
                        pick.Visible = false
                        y = true
                    end
                    if size >= 0.90 then
                        z = false
                        bar.Size = UDim2.new(0,0,1,0)
                        barframe.Visible = false
                        pick.Visible = false
                        done()
                        y = true
                    end
                end
            end
        end
    end)

    pick.MouseButton1Up:connect(function()  
        z = false
        bar.Size = UDim2.new(0,0,1,0)
        barframe.Visible = false
        pick.Visible = false
        y = true
        x = false
    end)

    function done()
end

end)

1
Your propaganda is confusing and incredibly naïve. BlueTaslem 18071 — 10y
0
I fixed it, it doesn't have to hurt your brain any more. 1234Christopher 10 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

Fixed it- mainly not putting (x = true) in the right places and I cleared it up :)

Play it here to test it for me! (Probably still some glitches)

Place: http://www.roblox.com/Nature-V-0-02-place?id=139229308

Ad

Answer this question