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 » Scripting Helpers
Home Search
 

Re: LocalScripts And AirplaneSeats

Previous Thread :: Next Thread 
Spacefarer is not online. Spacefarer
Joined: 01 Jan 2011
Total Posts: 5904
27 Mar 2014 07:22 PM
I need serious help.

I construct spacecraft and am an learning scripter, all of which are dependent on my aircraft seats.

Roblox tells me that the recent update has changed how hopper bins are used, and that I need a Local Script in order to make the seats work again.

I've transferred all my hopperbin code into Localscripts, but now the tool does not even show up, while prior to this, the tools would show up but not work.

Does anyone have a fix?
Report Abuse
devLucas is not online. devLucas
Joined: 10 Dec 2013
Total Posts: 526
27 Mar 2014 07:23 PM
It's the other way around, LocalScripts dont work in HopperBins.
Report Abuse
Spacefarer is not online. Spacefarer
Joined: 01 Jan 2011
Total Posts: 5904
27 Mar 2014 07:24 PM
Odd.
ROBLOX said that HopperBins wouldn't work unless they were in an localscript, and trust me, they don't.
Report Abuse
devLucas is not online. devLucas
Joined: 10 Dec 2013
Total Posts: 526
27 Mar 2014 07:26 PM
Hmm. Let me look at it.
Report Abuse
Spacefarer is not online. Spacefarer
Joined: 01 Jan 2011
Total Posts: 5904
27 Mar 2014 07:29 PM
Heres the tool script.

position = script.Parent.Position
local frame = Instance.new("CFrameValue")
frame.Name = "OriginCFrame"
frame.Value = script.Parent.CFrame
frame.Parent = script.Parent

local object = Instance.new("ObjectValue")
object.Value = script.Parent

seat = script.Parent
seat.Direction.cframe = seat.CFrame

function onSitUp(child, hopper, gui, plane)
if child.Parent == nil then
seat.Direction.maxTorque = Vector3.new(0,0,0)
seat.Thrust.maxForce = Vector3.new(0,0,0)
hopper.Parent = script
hopper.Active = false
gui.Parent = script
script.Parent.Locked = false
script.Parent.Parent = game.Workspace
end
end

function onChildAdded(part)
if part.className == "Weld" then
local torso = part.Part1
if torso ~= nil then

local char = torso.Parent
local player = game.Players:GetPlayerFromCharacter(char)
if player ~= nil then
local hopper = script["Aircraft"]
hopper.Parent = player.Backpack
local GUI = script["Controls"]
GUI.Parent = player.PlayerGui
part.AncestryChanged:connect(function(child) onSitUp(child, hopper, GUI, script.Parent) end)
end

local parent = torso.Parent
if parent ~= nil then
script.Parent.Locked = true
script.Parent.Parent = parent
end
end
end
end

seat.ChildAdded:connect(onChildAdded)
Report Abuse
Spacefarer is not online. Spacefarer
Joined: 01 Jan 2011
Total Posts: 5904
27 Mar 2014 07:30 PM
Inside the tool script is a tool, and inside the tool is this.

bin = script.Parent
plane = nil
hold = false
local debounce = false
local planedebounce = false
local stuntdebounce = false
local controlling = false
local currentspeed = 0
local turn = nil
fly = false

function computeDirection(vec)
local lenSquared = vec.magnitude * vec.magnitude
local invSqrt = 1 / math.sqrt(lenSquared)
return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt)
end

function move(point, engine)
local origincframe = engine:findFirstChild("Direction").cframe
size = engine.Size

target = engine.Position+((point - engine.Position).unit*100)
local dir = (target - engine.Position).unit
local spawnPos = engine.Position
left = engine.CFrame*CFrame.new(-size.x/2, 0, 0).p
right = engine.CFrame*CFrame.new(size.x/2, 0, 0).p
md = (target - engine.Position).magnitude

foebmd = engine.CFrame*CFrame.new(0, 0, -md).p
toleft = (target -left).magnitude
toright = (target -right).magnitude
rot = ((foebmd - target).magnitude/10)
local pos = spawnPos + (dir * 1)
turn = math.rad((rot/10)*engine.TiltFactor.Value)
if turn > math.rad(89) then
turn = math.rad(89)
end
if toleft< toright and toleft >rot then
engine:findFirstChild("Direction").cframe = CFrame.new(pos, pos + dir)*CFrame.fromEulerAnglesXYZ(0, 0, turn)
elseif toleft > toright and toright >rot then
engine:findFirstChild("Direction").cframe = CFrame.new(pos, pos + dir)*CFrame.fromEulerAnglesXYZ(0, 0, -turn)
else
engine:findFirstChild("Direction").cframe = CFrame.new(pos, pos + dir)
end
engine:findFirstChild("Direction").P = engine.TurnSpeed.Value
end

function findPlane(player)
local list = player.Character:GetChildren()
for x = 1, #list do
if (list[x].Name == "AircraftSeat") then
return list[x]
end
end
return nil
end

function onButton1Down(mouse)
local vehicle = findPlane(script.Parent.Parent.Parent)
if vehicle ~= nil and debounce == false and planedebounce == false then
if fly == false and taxi == false then return end
debounce = true

controlling = true

while true do
wait()
local engine = vehicle
local position = mouse.Hit
local target = position.p
move(target, engine)
if planedebounce == true or
controlling == false then break end
end
wait(0.1)
debounce = false
end
end

function onButton1Up(mouse)
controlling = false
end

function onSelected(mouse)
mouse.Icon = "http://www.roblox.com/asset/?id=7419350"
game.Workspace.CurrentCamera.CameraSubject = bin.Parent.Parent.Character.Head
game.Workspace.CurrentCamera.CameraType = "Track"
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
mouse.Button1Up:connect(function() onButton1Up(mouse) end)
mouse.KeyDown:connect(onKeyDown)
mouse.KeyUp:connect(onKeyUp)
mouse.Move:connect(function() Fly(mouse) end)
mouse.Idle:connect(function() Fly(mouse) end)
end

function onDeselected(mouse)
game.Workspace.CurrentCamera.CameraSubject = bin.Parent.Parent.Character.Humanoid
game.Workspace.CurrentCamera.CameraType = "Custom"
end

function Fly(mouse)
local vehicle = findPlane(script.Parent.Parent.Parent)
if (vehicle==nil) then return end
vehicle.Thrust.velocity = (vehicle.CFrame.lookVector * currentspeed) + Vector3.new(0,vehicle.LiftTrim.Value/100,0)
end

function onKeyDown(key)
if (key~=nil) then
key = key:lower()
local vehicle = findPlane(script.Parent.Parent.Parent)
if (vehicle==nil) then return end
if key == "y" then
fly = true
vehicle.Direction.cframe = vehicle.CFrame
vehicle.Direction.maxTorque = Vector3.new(4e3,4e3,4e3)
vehicle.Thrust.maxForce = Vector3.new(9e20,9e20,9e20)
while fly == true do
if currentspeed < vehicle.Speed.Value then
currentspeed = currentspeed + 1
elseif currentspeed > vehicle.Speed.Value then
currentspeed = currentspeed - 1
end
if vehicle.Acceleration.Value > 1000 then vehicle.Acceleration.Value = 1000 end
wait((1-(vehicle.Acceleration.Value/1000))+0.01)
if fly == false then break end
end
end
if key == "x" then
fly = false
currentspeed = 0
vehicle.Direction.maxTorque = Vector3.new(0,0,0)
vehicle.Thrust.maxForce = Vector3.new(0,0,0)
end
if key == "w" then
if vehicle.Speed.Value < vehicle.MaxSpeed.Value then
vehicle.Speed.Value = vehicle.Speed.Value + 10
end
end
if key == "s" then
if vehicle.Speed.Value > -10 then
vehicle.Speed.Value = vehicle.Speed.Value - 10
end
end
if key == "p" then
vehicle.Speed.Value = vehicle.MaxSpeed.Value
end
if key == ";" then
vehicle.Speed.Value = 0
end
if (key=="'") and (bin.Locked.Value == false) then
local repl = script:clone()
repl.Parent = bin
wait(1)
script:remove()
end
if key == "l" and fly == true then
vehicle.Direction.maxTorque = Vector3.new(4e3,0,4e3)
local frame = vehicle:FindFirstChild("OriginCFrame")
if frame ~= nil then
vehicle.Direction.cframe = frame.Value
end
wait(2)
vehicle.Direction.cframe = vehicle.CFrame
vehicle.Direction.maxTorque = Vector3.new(4e3,4e3,4e3)
end
end
end

function onKeyUp(key)
if (key~=nil) then
key = key:lower()
local vehicle = findPlane(script.Parent.Parent.Parent)
if (vehicle==nil) then return end
end
end

bin.Selected:connect(onSelected)
bin.Deselected:connect(onDeselected)
-- Mark901
Report Abuse
Spacefarer is not online. Spacefarer
Joined: 01 Jan 2011
Total Posts: 5904
27 Mar 2014 07:43 PM
b1
Report Abuse
FrozenBlueSky is not online. FrozenBlueSky
Joined: 06 Sep 2008
Total Posts: 5795
27 Mar 2014 07:48 PM
this man is an escaped convict from C&G

@all my haters u just need to (⌐□_□) LET IT GOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
Report Abuse
Spacefarer is not online. Spacefarer
Joined: 01 Jan 2011
Total Posts: 5904
27 Mar 2014 07:52 PM
b2
ignore above ^
Report Abuse
PyroSpear is not online. PyroSpear
Joined: 02 Jan 2013
Total Posts: 1098
27 Mar 2014 07:54 PM
he's fbi most wanted. stop him11111

-shenanigans-
Report Abuse
Spacefarer is not online. Spacefarer
Joined: 01 Jan 2011
Total Posts: 5904
27 Mar 2014 07:58 PM
bump
Report Abuse
Trapper4O77 is not online. Trapper4O77
Joined: 03 Aug 2011
Total Posts: 5648
27 Mar 2014 07:59 PM
Wait let me get this straight, local scripts in longer work in hopperbins???

- The Poptard -
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
27 Mar 2014 08:00 PM
They do
Report Abuse
Spacefarer is not online. Spacefarer
Joined: 01 Jan 2011
Total Posts: 5904
27 Mar 2014 08:00 PM
I don't know
ROBLOX says you need a hobberbins in a local script
But localscripts dont work with hopperbins

Report Abuse
Trapper4O77 is not online. Trapper4O77
Joined: 03 Aug 2011
Total Posts: 5648
27 Mar 2014 08:01 PM

I think it's the other way around. You need a localscript inside a hopperbin, not a regular script.

- The Poptard -
Report Abuse
Viscerate is not online. Viscerate
Joined: 02 Dec 2011
Total Posts: 3853
27 Mar 2014 08:02 PM
Get back here scrub
Report Abuse
Spacefarer is not online. Spacefarer
Joined: 01 Jan 2011
Total Posts: 5904
27 Mar 2014 08:09 PM
Bump

~ Only person to escape the salt mines
Report Abuse
PyroSpear is not online. PyroSpear
Joined: 02 Jan 2013
Total Posts: 1098
27 Mar 2014 08:10 PM
you may have escaped!

but nobody escapes and returns alive.

-.-
Report Abuse
Spacefarer is not online. Spacefarer
Joined: 01 Jan 2011
Total Posts: 5904
27 Mar 2014 08:12 PM
But I have.
I am the impossible.

Anyways, any help?

~ Only person to escape the salt mines
Report Abuse
Trapper4O77 is not online. Trapper4O77
Joined: 03 Aug 2011
Total Posts: 5648
27 Mar 2014 08:13 PM
Wait so space is a salt mine fugitive?

- The Poptard -
Report Abuse
Spacefarer is not online. Spacefarer
Joined: 01 Jan 2011
Total Posts: 5904
27 Mar 2014 08:25 PM
bump
please dont derail it

~ Escaped the salt mines | PostID=129143961
Report Abuse
shadowmanmatt987 is not online. shadowmanmatt987
Joined: 08 Apr 2012
Total Posts: 386
27 Mar 2014 08:34 PM
Hey it's Space, the criminal!
Report Abuse
Spacefarer is not online. Spacefarer
Joined: 01 Jan 2011
Total Posts: 5904
27 Mar 2014 08:36 PM
Just give me some help.
Report Abuse
PyroSpear is not online. PyroSpear
Joined: 02 Jan 2013
Total Posts: 1098
27 Mar 2014 08:53 PM
nop
Report Abuse
Spacefarer is not online. Spacefarer
Joined: 01 Jan 2011
Total Posts: 5904
28 Mar 2014 05:35 AM
B3
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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