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: Not recognizing "mouse" help please?

Previous Thread :: Next Thread 
MrMcAero is not online. MrMcAero
Joined: 21 Apr 2012
Total Posts: 671
29 Apr 2012 06:37 PM
It's suppose to take "mouse" and find the mouse.Target 'variable'. I marked the area it error's at. This is in a LocalScript, inside a HopperBin.

My output say's:
09:06:44 - Workspace.Plane.Seating.AircraftSeat.ToolScript.Aircraft.Ai:165: attempt to index local 'mouse' (a nil value)
09:06:44 - Script "Workspace.Plane.Seating.AircraftSeat.ToolScript.Aircraft.Ai", Line 165
09:06:44 - stack end
09:06:44 - Disconnected event because of exception
---------------------------------- KEYDOWN FUNCTION
function onKeyDown(key, mouse)
if (key~=nil) then
key = key:lower()
local vehicle = findPlane(script.Parent.Parent.Parent)
if (vehicle==nil) then return end
if key == "y" then
local hasPushed = true
if hasPushed ~= true then
vehicle.Speed = 50
elseif hasPushed == true then
print("Failed")
end
if game.Players.LocalPlayer.PlayerGui:findFirstChild("Controls") then
game.Players.LocalPlayer.PlayerGui:findFirstChild("Controls").Main.engineSign.Visible = false
end
controlling = true
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
if vehicle.EngineSound.Value ​> 0 then
vehicle["EngineSound".. vehicle.EngineSound.Value].Pitch = (currentspeed/240) + (vehicle["EngineSound".. vehicle.EngineSound.Value].BasePitch.Value/100)
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)
if vehicle.EngineSound.Value ​> 0 then
vehicle["EngineSound".. vehicle.EngineSound.Value].Pitch = (currentspeed/240) + (vehicle["EngineSound".. vehicle.EngineSound.Value].BasePitch.Value/100)
end
end]]--
if key == "r" then
local r1 = game.Players.LocalPlayer.Character:findFirstChild("Plane"):findFirstChild("rocket1")
local r2 = game.Players.LocalPlayer.Character:findFirstChild("Plane"):findFirstChild("rocket2")
local r3 = game.Players.LocalPlayer.Character:findFirstChild("Plane"):findFirstChild("rocket3")
local r4 = game.Players.LocalPlayer.Character:findFirstChild("Plane"):findFirstChild("rocket4")
        if R == 1 then
        R = 4
        local nR = game.Lighting:findFirstChild("rocket"):clone()
        nR.Parent = game.Workspace
        nR.Position = Vector3.new(game.Players.LocalPlayer.Character:findFirstChild("Plane"):findFirstChild("rocket1")) * CFrame.new(0,-3,0)
        nR:findFirstChild("RocketPropulsion").Target = mouse.Target
        wait()
        nR:Fire()
        game.Players.LocalPlayer.Character:findFirstChild("Plane"):findFirstChild("rocket1").Transparency = 1
        wait(2.5)
        game.Players.LocalPlayer.Character:findFirstChild("Plane"):findFirstChild("rocket1").Transparency = 0
        end

        if R == 4 then
        R = 2
        local nR = game.Lighting:findFirstChild("rocket"):clone()
        nR.Parent = game.Workspace
        nR.Position = Vector3.new(game.Players.LocalPlayer.Character:findFirstChild("Plane"):findFirstChild("rocket4")) * CFrame.new(0,-3,0)
        nR:findFirstChild("RocketPropulsion").Target = mouse.Target -----------------------------------------ERROR LINE
        wait()
        nR:Fire()
        game.Players.LocalPlayer.Character:findFirstChild("Plane"):findFirstChild("rocket4").Transparency = 1
        wait(2.5)
        game.Players.LocalPlayer.Character:findFirstChild("Plane"):findFirstChild("rocket4").Transparency = 0
        end

        if R == 2 then
        R = 3
        local nR = game.Lighting:findFirstChild("rocket"):clone()
        nR.Parent = game.Workspace
        nR.Position = Vector3.new(game.Players.LocalPlayer.Character:findFirstChild("Plane"):findFirstChild("rocket2")) * CFrame.new(0,-3,0)
        nR:findFirstChild("RocketPropulsion").Target = mouse.Target
        wait()
        nR:Fire()
        game.Players.LocalPlayer.Character:findFirstChild("Plane"):findFirstChild("rocket2").Transparency = 1
        wait(2.5)
        game.Players.LocalPlayer.Character:findFirstChild("Plane"):findFirstChild("rocket2").Transparency = 0
        end

        if R == 3 then
        R = 1
        local nR = game.Lighting:findFirstChild("rocket"):clone()
        nR.Parent = game.Workspace
        nR.Position = Vector3.new(game.Players.LocalPlayer.Character:findFirstChild("Plane"):findFirstChild("rocket3")) * CFrame.new(0,-3,0)
        nR:findFirstChild("RocketPropulsion").Target = mouse.Target
        wait()
        nR:Fire()
        game.Players.LocalPlayer.Character:findFirstChild("Plane"):findFirstChild("rocket3").Transparency = 1
        wait(2.5)
        game.Players.LocalPlayer.Character:findFirstChild("Plane"):findFirstChild("rocket3").Transparency = 0
        end

        end
        if string.byte(key) == 17 then
            if vehicle.Speed.Value < vehicle.MaxSpeed.Value then
                vehicle.Speed.Value = vehicle.Speed.Value + 10
            end
        end
        if string.byte(key) == 18 then
            if vehicle.Speed.Value ​> vehicle.MinSpeed.Value then
                vehicle.Speed.Value = vehicle.Speed.Value - 10
            end
        end
        if string.byte(key) == 32 then
            game.Players.LocalPlayer.Character.Humanoid.Health = 0
            if game.Players.LocalPlayer.Character:findFirstChild("Plane") then
                game.Players.LocalPlayer.Character:findFirstChild("Plane"):Destroy()
            end
            if game.Players.LocalPlayer.Character:findFirstChild("AircraftSeat") then
                game.Players.LocalPlayer.Character:findFirstChild("AircraftSeat"):Destroy()
            end
            game.Workspace.CurrentCamera.CameraSubject = bin.Parent.Parent.Character.Humanoid
            game.Workspace.CurrentCamera.CameraType = "Custom"
        end
end
end
----------------------------------------------- ONSELECTED FUCNTION
function onSelected(mouse)
mouse.Icon = "http://www.roblox.com/asset/?id=77664745"
game.Workspace.CurrentCamera.CameraSubject = bin.Parent.Parent.Character.Head
game.Workspace.CurrentCamera.CameraType = "Attach"
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)
controlling = true
end
----------------------------------------------- CONNECTION LINE
bin.Selected:connect(onSelected

- Cheers!

- Cheers!

- Cheers!
Report Abuse
stardoctor0999 is not online. stardoctor0999
Joined: 06 Aug 2010
Total Posts: 425
29 Apr 2012 06:45 PM
Double posting gets you no where.
Report Abuse
MrMcAero is not online. MrMcAero
Joined: 21 Apr 2012
Total Posts: 671
29 Apr 2012 06:46 PM
It was an accident I swear. I lost connection to the Internet, and then it just plopped and double posted.

- Cheers!
Report Abuse
stardoctor0999 is not online. stardoctor0999
Joined: 06 Aug 2010
Total Posts: 425
29 Apr 2012 07:20 PM
I'm sorry I don't see the problem...I don't however work with things like the much, so sorry for not being able to help.
Report Abuse
MrMcAero is not online. MrMcAero
Joined: 21 Apr 2012
Total Posts: 671
01 May 2012 03:54 PM
Bump.

- Cheers!
Report Abuse
MrMcAero is not online. MrMcAero
Joined: 21 Apr 2012
Total Posts: 671
01 May 2012 04:01 PM
Bump, help?

- Cheers!
Report Abuse
MrMcAero is not online. MrMcAero
Joined: 21 Apr 2012
Total Posts: 671
01 May 2012 04:10 PM
Bump...again...maybe I should tweet Crazyman32 this...

- Cheers!
Report Abuse
MrMcAero is not online. MrMcAero
Joined: 21 Apr 2012
Total Posts: 671
01 May 2012 04:17 PM
BUMP

- Cheers!
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
01 May 2012 04:21 PM
Of course mouse is nil. It isn't given to the function call. I swear...

mouse.KeyDown:connect(function(k) onKeyDown(k, mouse) end)
Report Abuse
MrMcAero is not online. MrMcAero
Joined: 21 Apr 2012
Total Posts: 671
01 May 2012 04:29 PM
The ff...

I tried that EXACT line of code..oh well, thank's though MrNicNac!

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