generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Why doesn't this regen? Please help!

Previous Thread :: Next Thread 
derfvb123 is not online. derfvb123
Joined: 23 Oct 2011
Total Posts: 704
20 Oct 2015 04:19 PM
Regen doesnt work for some reason, can someone help please?

local Tool = script.Parent

Me=game:service("Players").LocalPlayer
Char=Me.Character
Mouse=Me:GetMouse()
potato=script.Parent
hold=false
Char:MoveTo(Vector3.new(0,100,0))
local fuel = Tool.CurrFuel.Value
local maxFuel = 300
local regen = false

function GoUp()
hold=true
incr=0.25
print("hi")
if Char:FindFirstChild("DaForce") == nil then
bp=Instance.new("BodyPosition",Char.Torso)
bp.maxForce=Vector3.new(0,math.abs(Char.Torso.Velocity.y+(10^4*6)),0)
print("hi2")
bp.position=Char.Torso.Position
bp.Name='DaForce'
end

while hold do wait()
if incr < 11 then
incr=incr+0.6
fuel = fuel - 1
Tool.CurrFuel.Value = fuel
if fuel <= 0 then
cutEngine()
print("Hi3")
end
updateGUI()
wait()

end

pcall(function() bp.position=Char.Torso.CFrame*CFrame.new(0,incr,0).p end)
end
for _,v in pairs(Char.Torso:children()) do
if v:IsA("BodyPosition") then
v:Destroy()
print("hi4")
end
end
end
game:GetService("UserInputService").InputBegan:connect(function(Key)
if Key.KeyCode == Enum.KeyCode.Space and fuel > 0 then
GoUp()
print("hi5")
end
end)

game:GetService("UserInputService").InputEnded:connect(function(Key)
if Key.KeyCode == Enum.KeyCode.Space then
hold=false
print("hi6")
end
end)






while regen==true do


regen = true
if fuel < maxFuel then -----------------!!!!!!!!!!REGENNNNN HEREEE!!!
wait(2)
print("hi7")
fuel = fuel + 1
Tool.CurrFuel.Value = fuel
updateGUI()
regen=false


end
wait(1)
end




function updateGUI()

potato.Frame.Size = UDim2.new(0,40,0,300 * (Tool.CurrFuel.Value/maxFuel))
potato.Frame.Position = UDim2.new(0.9,0,0.2 + (0.2 * ((maxFuel - Tool.CurrFuel.Value)/maxFuel)),0)

end
function cutEngine()
for _,v in pairs(Char.Torso:children()) do
if v:IsA("BodyPosition") then

end
end
end







[]Online dancing since 1337[]
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image