ROBLOX scripting Lua

4 replies [Last post]
AustinAre31
Location: In Subway making your sandwich.
Posts:

i know this is old but i need help with this fly script. this fly script works but can anyone make it go into brick where you have to buy it for 1 Cash. and can someone make it where it only works for 5 seconds after you start using it? Thanks also if you know how post on this and send me a message (Are31 or Regenerators)

local power = 15
wait()
bin = script.Parent
bpos = Instance.new("BodyPosition")
gyro = Instance.new("BodyGyro")
gyro.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
bpos.maxForce = Vector3.new(math.huge,math.huge,math.huge)
fly = false
player = game.Players.LocalPlayer
char = player.Character.Torso
airborne = false

function onButton1Down(mouse)
fly = true
while fly do
pos = mouse.Hit.p
--gyro.cframe = CFrame.new(char.Position,pos)
bpos.position = char.Position + (pos-char.Position).unit * power
wait()
end
end

function onMove(mouse)
pos = mouse.Hit.p
gyro.cframe = CFrame.new(char.Position,pos) * CFrame.fromEulerAnglesXYZ(-3.14/2+1.2,0,0)
--bpos.position = char.Position +
--wait()
--end
end

function onButton1Up(mouse)
fly = false
end

function onSelected(mouse)
print("select")
if mouse == nil then
return
end
airborne = true
bpos.Parent = char
bpos.position = char.Position + Vector3.new(0,10,0)
gyro.Parent = char
char.Parent.Humanoid.Sit = true
mouse.Icon = "http://www.roblox.com/asset/?id=4941056"
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
mouse.Button1Up:connect(function() onButton1Up(mouse) end)
mouse.Move:connect(function() onMove(mouse) end)

for i, v in ipairs(char:GetChildren()) do
if v.className == "Motor" then
v.MaxVelocity = 0
v.CurrentAngle = -1
if v.Name == "Left Hip" then
v.CurrentAngle = 1
end
end
end
end

function onDeselected(mouse)
print("deselect")
gyro.Parent = nil
fly = false
airborne = false
for i, v in ipairs(char:GetChildren()) do
if v.className == "Motor" then
v.MaxVelocity = 1
end
end
char.Parent.Humanoid.Sit = false
for i = 1, 30 do
if not airborne then
bpos.position = bpos.position - Vector3.new(0,0.3,0)
wait(0.1)
end
end
if not airborne then
bpos.Parent = nil
end
end

bin.Selected:connect(onSelected)
bin.Deselected:connect(onDeselected)

Im Are31 on Roblox. Banned for now so add me as 444bbb

billycheezit's picture
billycheezit
Location: base 7. AKA: where you aren't
Posts:

you need more "end"

also, im pretty sure "airborne" isnt a command. unless theve added that.

***PLACEHOLDER TEXT***

AustinAre31
Location: In Subway making your sandwich.
Posts:

crud

Im Are31 on Roblox. Banned for now so add me as 444bbb

QuentOS's picture
QuentOS
Formerly Quentonious
Location: Somewhere on Mars
Posts:

I know for a fact that airborne isn't a command. But it was declared earlier, and Austin didn't need it fixed. It works. Please notfiy us when you tl;dr something.

Who was that masked moron?

AustinAre31
Location: In Subway making your sandwich.
Posts:

i was trying to get someone to help me make it better

Im Are31 on Roblox. Banned for now so add me as 444bbb