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: problems with this mouse script

Previous Thread :: Next Thread 
carbondudeoxide is not online. carbondudeoxide
Joined: 04 Mar 2011
Total Posts: 556
06 Aug 2011 03:23 PM
hi guys im having problems with this mouse select script. basicaly what it should do is when you click (with the previus key being the left shift) it will cheack weather or not there is a humanoid there or a humanoid sitting oin a vehicle then set the vehicle.Target.Value to the character
... anny ideas on why its not working?

function onButton1Down(mouse)
if (prevKey == string.byte(46)) then
local vehicle = findVehicle()
local target = mouse.Hit
if (target.Parent.Name == "Fuselage") then
if (target.Parent.Parent.Parent:FindFirstChild("Humanoid") ~= nil) then
vehicle.Target.Value = target.Parent.Parent.Parent
end
elseif (target.Parent:FindFirstChild("Humanoid") ~= nil) then
vehicle.Target.Value = target.Parent.Parent.Parent
else
vehicle.Target.Value = nil
end
end
Report Abuse
carbondudeoxide is not online. carbondudeoxide
Joined: 04 Mar 2011
Total Posts: 556
06 Aug 2011 04:43 PM
bump
Report Abuse
carbondudeoxide is not online. carbondudeoxide
Joined: 04 Mar 2011
Total Posts: 556
06 Aug 2011 06:13 PM
here is a more recent version of the script but it it still is ot working T.T

function onButton2Down(mouse)
local vehicle = findVehicle()
local target = mouse.Target
if (target.Parent.Name == "Fuselage") then
if (target.Parent.Parent.Parent:FindFirstChild("Humanoid") ~= nil) then
vehicle.Target.Value = target.Parent.Parent.Parent
end
elseif (target.Parent:FindFirstChild("Humanoid") ~= nil) then
vehicle.Target.Value = target.Parent.Parent.Parent
else
vehicle.Target.Value = nil
end
end
Report Abuse
scepile3 is not online. scepile3
Joined: 27 Feb 2009
Total Posts: 260
06 Aug 2011 07:38 PM
... What's in the function: findVehicle() ?
Report Abuse
stephendsdude is not online. stephendsdude
Joined: 19 Apr 2008
Total Posts: 1691
06 Aug 2011 07:40 PM
Is this all you have in the script? Show us the entire script.
Report Abuse
carbondudeoxide is not online. carbondudeoxide
Joined: 04 Mar 2011
Total Posts: 556
06 Aug 2011 07:40 PM
ok more info mation on it...

the function does get called and i even put print(mouse.Target) and it was printing the name of the part i right clicked, but it would not go any further and was not printing any errors...
Report Abuse
carbondudeoxide is not online. carbondudeoxide
Joined: 04 Mar 2011
Total Posts: 556
07 Aug 2011 11:53 AM
Bump!!!
Report Abuse
carbondudeoxide is not online. carbondudeoxide
Joined: 04 Mar 2011
Total Posts: 556
07 Aug 2011 02:26 PM
look guys this is starting to bug me... ive tryed so many ways to get it to work but it wont..... please soem one help!!
Report Abuse
carbondudeoxide is not online. carbondudeoxide
Joined: 04 Mar 2011
Total Posts: 556
07 Aug 2011 03:06 PM
so no one is going to awnser T.T
Report Abuse
carbondudeoxide is not online. carbondudeoxide
Joined: 04 Mar 2011
Total Posts: 556
07 Aug 2011 05:46 PM
bump
Report Abuse
carbondudeoxide is not online. carbondudeoxide
Joined: 04 Mar 2011
Total Posts: 556
08 Aug 2011 03:02 AM
bump.
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
08 Aug 2011 03:10 AM
[ Content Deleted ]
Report Abuse
carbondudeoxide is not online. carbondudeoxide
Joined: 04 Mar 2011
Total Posts: 556
08 Aug 2011 03:18 AM
that meaning?
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
08 Aug 2011 04:19 AM
[ Content Deleted ]
Report Abuse
carbondudeoxide is not online. carbondudeoxide
Joined: 04 Mar 2011
Total Posts: 556
08 Aug 2011 04:20 AM
i havent posted up the findVehicle() function but it links to another function in the script and then that returns the vehicle as an object value
Report Abuse
carbondudeoxide is not online. carbondudeoxide
Joined: 04 Mar 2011
Total Posts: 556
08 Aug 2011 04:21 AM
function findVehicle()
if (player == nil) or (player.Character == nil) then return end
local tag = player.Character:findFirstChild(ship_tag,true)
if (tag ~= nil) and (tag.className == "ObjectValue") and (tag.Parent ~= player.Character) then
return tag.Parent
end
end

there u go
Report Abuse
BloxBuilder900 is not online. BloxBuilder900
Joined: 31 Mar 2009
Total Posts: 2231
08 Aug 2011 05:42 AM
Post the whole script so we can help :|
Report Abuse
carbondudeoxide is not online. carbondudeoxide
Joined: 04 Mar 2011
Total Posts: 556
08 Aug 2011 05:49 AM
the functions currently are

function Button2Up(mouse)
print("working")
end

function Button2Down(mouse)
print("working")
end

there like that for debugging currently
but they are not printing
Report Abuse
carbondudeoxide is not online. carbondudeoxide
Joined: 04 Mar 2011
Total Posts: 556
08 Aug 2011 05:51 AM
wrong post...
Report Abuse
carbondudeoxide is not online. carbondudeoxide
Joined: 04 Mar 2011
Total Posts: 556
08 Aug 2011 05:51 AM
wait one sec... it is the right post i just posted wrong thing
Report Abuse
carbondudeoxide is not online. carbondudeoxide
Joined: 04 Mar 2011
Total Posts: 556
08 Aug 2011 05:54 AM
function onButton2Down(mouse)

local vehicle = findVehicle()
local target = mouse.Target
print(target)
print(target.Parent)
if (vehicle ~= nil) then
if (mouse.Target.Parent.Name == "Fuselage") then
if (mouse.Target.Parent.Parent.Parent:FindFirstChild("Humanoid") ~= nil) then
vehicle.Target.Value = mouse.Target.Parent.Parent.Parent
end
elseif (mouse.Target.Parent:FindFirstChild("Humanoid") ~= nil) then
vehicle.Target.Value = target.Parent
else
print("Fail")
vehicle.Target.Value = nil
end
else
print("ERROR")
end

end

function onButton2Up(mouse)
print("calledUp")
end

function onButton1Down(mouse)

if (not starting) then
local vehicle = findVehicle()
if (controlling) or (vehicle == nil) then return end
controlling = true

mouse.Icon = "rbxasset://textures\\CameraCenter_ds.png"

while (controlling) do
local engine = vehicle.Fuselage.Engine
local target = mouse.Hit.p
if (vehicle.EngineActive.Value) then
move(target,engine)
end
wait()
end
end
end

function onButton1Up(mouse)
controlling = false
mouse.Icon = "rbxasset://textures\\CameraCenter.png"
end

function onSelected(mouse)
onButton1Up(mouse)

mouse.Button1Down:connect(function() onButton1Down(mouse) end)
mouse.Button1Up:connect(function() onButton1Up(mouse) end)
mouse.Button2Down:connect(function() onButton2Down(mouse) end)
mouse.Button2Up:connect(function() onButton2Up(mouse) end)
mouse.KeyDown:connect(onKeyDown)
mouse.KeyUp:connect(onKeyUp)
end

this is the parts you need to worry about (apart from the findVehicle which ive already posted)
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