|
| 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 |
|
|
| |
|
|
| 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
|
  |
| Joined: 27 Feb 2009 |
| Total Posts: 260 |
|
|
| 06 Aug 2011 07:38 PM |
| ... What's in the function: findVehicle() ? |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2011 07:40 PM |
| Is this all you have in the script? Show us the entire script. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
| |
|
|
| 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 |
|
|
|
| 07 Aug 2011 03:06 PM |
| so no one is going to awnser T.T |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 08 Aug 2011 05:42 AM |
| Post the whole script so we can help :| |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
| |
|
|
| 08 Aug 2011 05:51 AM |
| wait one sec... it is the right post i just posted wrong thing |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|