VoidFrost
|
  |
| Joined: 14 Oct 2011 |
| Total Posts: 1188 |
|
|
| 23 Jul 2017 11:52 AM |
| i am in the process of scripting a vehicle. now when you enter a vehicle, you will be able to do different controls such as speed up the vehicle, have it follow the mouse cursor, fire with weapons, etc. all this requires the usage of events. the question is, should i use the :disconnect method on the events every time i exit the vehicle, or should the events always be connected but have an if statement so that it only works while inside a vehicle? |
|
|
| Report Abuse |
|
|
|
| 23 Jul 2017 12:10 PM |
| You cannot use mouse events on the server. A common way to handle the controls of a vehicle is for a script to inject a local script into the character that sits on the seat. Removing the script when the character leaves the seat will terminate all the connections. It is more efficient to disconnect the event that run logic inside of it, especially if it is being done for multiple vehicles. |
|
|
| Report Abuse |
|
|
VoidFrost
|
  |
| Joined: 14 Oct 2011 |
| Total Posts: 1188 |
|
|
| 23 Jul 2017 12:13 PM |
| what do you mean "cannot use mouse events on the server"? also, are you certain it is best to just insert the localscript? |
|
|
| Report Abuse |
|
|
VoidFrost
|
  |
| Joined: 14 Oct 2011 |
| Total Posts: 1188 |
|
| |
|
doggy00
|
  |
| Joined: 11 Jan 2011 |
| Total Posts: 3571 |
|
|
| 23 Jul 2017 01:54 PM |
| He means the player's mouse and other types of input can only be accessed via local scripts, not server scripts. |
|
|
| Report Abuse |
|
|
VoidFrost
|
  |
| Joined: 14 Oct 2011 |
| Total Posts: 1188 |
|
|
| 23 Jul 2017 02:37 PM |
| that's obvious. why is that being stated? also, is putting a localscript inside the character the best approach to this? |
|
|
| Report Abuse |
|
|
VoidFrost
|
  |
| Joined: 14 Oct 2011 |
| Total Posts: 1188 |
|
|
| 23 Jul 2017 02:38 PM |
| i dont use the natural roblox seats, if he thought i was doing that. i enter vehicles through a local system and then teleport the player into the vehicle through remotes |
|
|
| Report Abuse |
|
|
VoidFrost
|
  |
| Joined: 14 Oct 2011 |
| Total Posts: 1188 |
|
| |
|
|
| 23 Jul 2017 04:38 PM |
| either way it won't really affect much unless you have the worst computer in the world, but if I would have the choice I would disconnect all the events. An easy way to do that is create a table for your connections and when you get out of the seat it ########### everything inside of that table and resets it |
|
|
| Report Abuse |
|
|
VoidFrost
|
  |
| Joined: 14 Oct 2011 |
| Total Posts: 1188 |
|
|
| 23 Jul 2017 04:50 PM |
| that's one of the options. isn't the adding a localscript in the character better? if you were gonna make a professional popular game, what would you do |
|
|
| Report Abuse |
|
|