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)
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