Keyrut
|
  |
| Joined: 23 Nov 2011 |
| Total Posts: 6501 |
|
|
| 05 Aug 2012 01:11 AM |
if key == "g" then game.Workspace.f221.Wheels.Children.Transparency = 0 and game.Workspace.f221.Wheels.Children.CanCollide = true |
|
|
| Report Abuse |
|
|
| |
|
Sehnsucht
|
  |
| Joined: 10 Apr 2011 |
| Total Posts: 990 |
|
|
| 05 Aug 2012 01:13 AM |
| No. 'key' is nil, and unless 'Children' is a valid BasePart with a Transparency property and CanCollide property, that would not work. And the 'and' in between should be removed. |
|
|
| Report Abuse |
|
|
Keyrut
|
  |
| Joined: 23 Nov 2011 |
| Total Posts: 6501 |
|
|
| 05 Aug 2012 01:13 AM |
er can you fix it because i havent got a clue whats wrong lol
|
|
|
| Report Abuse |
|
|
Sehnsucht
|
  |
| Joined: 10 Apr 2011 |
| Total Posts: 990 |
|
|
| 05 Aug 2012 01:14 AM |
| Is this a hopperbin/tool? If so which one. |
|
|
| Report Abuse |
|
|
Keyrut
|
  |
| Joined: 23 Nov 2011 |
| Total Posts: 6501 |
|
| |
|
swmaniac
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 05 Aug 2012 01:17 AM |
Computer's opinion:
if key == "g" then -- What is key? Well, guess it's nothing... so this if statement doesn't run. Better go find the else or end. game.Workspace.f221.Wheels.Children.Transparency = 0 --Ignores (also likely wrong) and game.Workspace.f221.Wheels.Children.CanCollide = true -- Ignores (also likely wrong) --Wait... where's the end? O_o *Error*
The concepts you missed: All information in Roblox has to come FROM somewhere, you assumed that the computer automatically knew what you meant by key and "Children." It didn't.
You get that information using the mouse.KeyDown event (mouse is obtained with a Tool's Equipped event); from the :GetChildren method (which you must then tell the computer how to use) respectively. |
|
|
| Report Abuse |
|
|
|
| 05 Aug 2012 01:18 AM |
| Not trying to be mean, but everything is wrong (or just not there at all). |
|
|
| Report Abuse |
|
|
Sehnsucht
|
  |
| Joined: 10 Apr 2011 |
| Total Posts: 990 |
|
|
| 05 Aug 2012 01:19 AM |
| Uhg.. you really shouldn't be here. Or on the internet. And what is the script inside? |
|
|
| Report Abuse |
|
|
swmaniac
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 05 Aug 2012 01:21 AM |
| ...Man some of you guys are being mean. He doesn't know how to script, big deal - neither does 99.9% of humanity. |
|
|
| Report Abuse |
|
|
Keyrut
|
  |
| Joined: 23 Nov 2011 |
| Total Posts: 6501 |
|
|
| 05 Aug 2012 01:24 AM |
@Swmaniac ehhh sorry for being the .1? |
|
|
| Report Abuse |
|
|
Keyrut
|
  |
| Joined: 23 Nov 2011 |
| Total Posts: 6501 |
|
|
| 05 Aug 2012 01:26 AM |
this is the script: 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=89005817" 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 == "g" then game.Workspace.f221.Wheels.Children.Transparency = 0 and game.Workspace.f221.Wheels.Children.CanCollide = true 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)
|
|
|
| Report Abuse |
|
|
|
| 05 Aug 2012 01:29 AM |
| If key and Children are set to variables idk maybe |
|
|
| Report Abuse |
|
|
|
| 05 Aug 2012 01:31 AM |
| Oh, see, that's different, why did you just pull out those 3 lines from the script? |
|
|
| Report Abuse |
|
|
Keyrut
|
  |
| Joined: 23 Nov 2011 |
| Total Posts: 6501 |
|
| |
|
Keyrut
|
  |
| Joined: 23 Nov 2011 |
| Total Posts: 6501 |
|
| |
|
Sehnsucht
|
  |
| Joined: 10 Apr 2011 |
| Total Posts: 990 |
|
|
| 05 Aug 2012 01:44 AM |
| No. It doesn't work. The one line you added to it was incorrect and made the script error. |
|
|
| Report Abuse |
|
|