mystic48
|
  |
| Joined: 02 Apr 2009 |
| Total Posts: 1439 |
|
|
| 20 Jul 2012 02:24 PM |
I have a button with this script in:
function onClicked() p = game.Players:GetChildren() for i = 1, #p do p[i].Character.Car.VehicleSeat.MaxSpeed = 0 end end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
As you can see, it forces a car to stop (changing speed). It only works if I'm in the car, not when others are in. the car. Any help would be appreciated, thank you! |
|
|
| Report Abuse |
|
|
MrChubbs
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
|
| 20 Jul 2012 02:28 PM |
| Are you sure the car is a child of the other players when they sit in it? |
|
|
| Report Abuse |
|
|
abx1
|
  |
| Joined: 13 Nov 2008 |
| Total Posts: 4979 |
|
|
| 20 Jul 2012 02:29 PM |
@MrChubbs
VehicleSeat's do that. |
|
|
| Report Abuse |
|
|
mystic48
|
  |
| Joined: 02 Apr 2009 |
| Total Posts: 1439 |
|
|
| 20 Jul 2012 02:34 PM |
Double checked the models, directory etc.
The weird thing is, now its not working for myself either unlike a few minutes ago. |
|
|
| Report Abuse |
|
|
MrChubbs
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
|
| 20 Jul 2012 02:37 PM |
| No they do not, the car remains in workspace unless you put a script to change its parent. |
|
|
| Report Abuse |
|
|
MrChubbs
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
|
| 20 Jul 2012 02:37 PM |
| Whats the output when it doesn't work? |
|
|
| Report Abuse |
|
|
abx1
|
  |
| Joined: 13 Nov 2008 |
| Total Posts: 4979 |
|
|
| 20 Jul 2012 02:37 PM |
function onClicked() p = game.Players:GetChildren() for i = 1, #p do if p[i]:findFirstChild("Car") ~= nil then p[i].Character.Car.VehicleSeat.MaxSpeed = 0 end end end
script.Parent.ClickDetector.MouseClick:connect(onClicked) |
|
|
| Report Abuse |
|
|
MrChubbs
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
|
| 20 Jul 2012 02:40 PM |
function onClicked() p = game.Players:GetChildren() for i = 1, #p do if p[i]:findFirstChild("Car") then p[i].Character.Car.VehicleSeat.Torque = 0 end end end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
|
|
| Report Abuse |
|
|
MrChubbs
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
|
| 20 Jul 2012 02:41 PM |
| This one is slightly better because now it can't turn. |
|
|
| Report Abuse |
|
|
mystic48
|
  |
| Joined: 02 Apr 2009 |
| Total Posts: 1439 |
|
|
| 20 Jul 2012 03:11 PM |
| No output detected and the new scripts (neither of them) are functional, sadly. |
|
|
| Report Abuse |
|
|
mystic48
|
  |
| Joined: 02 Apr 2009 |
| Total Posts: 1439 |
|
| |
|
MrChubbs
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
|
| 20 Jul 2012 03:19 PM |
function onClicked() p = game.Players:GetChildren() for i = 1, #p do if p[i]:findFirstChild("Car") then print("Car Found") else print("No Car") end if workspace:findFirstChild("Car") then print("Car is in workspace") end end end
script.Parent.ClickDetector.MouseClick:connect(onClicked) |
|
|
| Report Abuse |
|
|
mystic48
|
  |
| Joined: 02 Apr 2009 |
| Total Posts: 1439 |
|
|
| 20 Jul 2012 03:30 PM |
| The car is in the workspace, now I know this may be a stupid question but how can I adjust the code to work for the workspace now while ensuring the code still works for all players? |
|
|
| Report Abuse |
|
|
MrChubbs
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
|
| 20 Jul 2012 03:57 PM |
function onClicked() p = game.Players:GetChildren() workspace.Car.VehicleSeat.MaxSpeed = 0 -- assuming there is only one car. end
script.Parent.ClickDetector.MouseClick:connect(onClicked) |
|
|
| Report Abuse |
|
|
MrChubbs
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
|
| 20 Jul 2012 03:58 PM |
| Woops, get rid of the p = line. |
|
|
| Report Abuse |
|
|
mystic48
|
  |
| Joined: 02 Apr 2009 |
| Total Posts: 1439 |
|
|
| 20 Jul 2012 04:01 PM |
| and if there are multiple ones with the same name for multiple players? |
|
|
| Report Abuse |
|
|
|
| 20 Jul 2012 05:02 PM |
The problem is that you have no redundancy if there is no car in the player, the script will break.
The future is on the Horizone...
S-1894>() |
|
|
| Report Abuse |
|
|