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