24stop
|
  |
| Joined: 30 Jul 2015 |
| Total Posts: 107 |
|
|
| 23 Aug 2015 08:57 AM |
| I need help on a script on this car, so when somebody drives it (gets in the seat) it will clone the car |
|
|
| Report Abuse |
|
|
| |
|
24stop
|
  |
| Joined: 30 Jul 2015 |
| Total Posts: 107 |
|
| |
|
|
| 23 Aug 2015 10:02 AM |
Hi there, To get this to work, you would need to use the "Occupant" humanoid type value. This will check if a player has sat on the seat or if the player has left the seat.
You can read more about it here: http://wiki.roblox.com/index.php?title=API:Class/Seat/Occupant
Luckily, the example they've provided is easily adaptable to your situation.
The solution is this:
local seat = workspace.Car.Seat seat.Changed:connect(function(property) if property ~= 'Occupant' then return end local occupant = seat.Occupant if occupant then local character = occupant.Parent local player = game.Players:GetPlayerFromCharacter(character) if player then workspace.Car:Clone() end end end) |
|
|
| Report Abuse |
|
|
24stop
|
  |
| Joined: 30 Jul 2015 |
| Total Posts: 107 |
|
|
| 23 Aug 2015 10:34 AM |
| Hey. That script didn't work. :( |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2015 10:42 AM |
Any output errors?
If you go to View and click output and test the game, I usually tells you what's wrong with the script. Can you paste any text in bright red for me? |
|
|
| Report Abuse |
|
|
24stop
|
  |
| Joined: 30 Jul 2015 |
| Total Posts: 107 |
|
|
| 23 Aug 2015 12:29 PM |
| there is nothing in the output. Maybe the script was wrong? |
|
|
| Report Abuse |
|
|
24stop
|
  |
| Joined: 30 Jul 2015 |
| Total Posts: 107 |
|
|
| 23 Aug 2015 12:33 PM |
| i can send you a video of what is happening so you can get a better understanding of what to do. |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2015 12:37 PM |
So did it not clone anything?
Throw some prints in the script and see where it stops. |
|
|
| Report Abuse |
|
|
24stop
|
  |
| Joined: 30 Jul 2015 |
| Total Posts: 107 |
|
|
| 23 Aug 2015 12:40 PM |
| Yea, its not cloning anything. I am uploading a vid to youtube so you can see whats going on. |
|
|
| Report Abuse |
|
|
24stop
|
  |
| Joined: 30 Jul 2015 |
| Total Posts: 107 |
|
|
| 23 Aug 2015 12:49 PM |
here: https :// youtu .be/lRMCg kPY-UE
(remove spaces) |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2015 01:27 PM |
local currentcar = workspace.Car local seat = workspace.Car.Drive workspace.Car:SetPrimaryPartCFrame(seat) seat.Changed:connect(function(property) if property ~= 'Occupant' then return end local occupant = seat.Occupant if occupant then local character = occupant.Parent local player = game.Players:GetPlayerFromCharacter(character) if player then local car = game.Workspace.Car:Clone() car.Parent = game.Workspace end end end)
this will clone the car, but it will be the exact position of the old car and the wheels will not be welded to the car. |
|
|
| Report Abuse |
|
|
24stop
|
  |
| Joined: 30 Jul 2015 |
| Total Posts: 107 |
|
| |
|
24stop
|
  |
| Joined: 30 Jul 2015 |
| Total Posts: 107 |
|
|
| 23 Aug 2015 04:02 PM |
| can anyone send me a vid of the script he's using, i want to see what I'm doing wrong. |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2015 04:27 PM |
Ok, this does clone the car. But it does not clone above the original car, it clones directly at its position, even though i tried setting it so it cloned somewhere different.
local currentcar = workspace.Car local seat = workspace.Car.Drive currentcar.PrimaryPart = currentcar.Base seat.Changed:connect(function(property) if property ~= 'Occupant' then return end local occupant = seat.Occupant if occupant then local character = occupant.Parent local player = game.Players:GetPlayerFromCharacter(character) if player then local car = game.Workspace.Car:Clone() car.PrimaryPart = car.Base car.PrimaryPart.Position = currentcar.PrimaryPart.Position+Vector3.new(0,0,10) car.Parent = game.Workspace end end end) |
|
|
| Report Abuse |
|
|
24stop
|
  |
| Joined: 30 Jul 2015 |
| Total Posts: 107 |
|
| |
|
SkySpell
|
  |
| Joined: 01 Sep 2008 |
| Total Posts: 1581 |
|
|
| 24 Aug 2015 08:26 AM |
| Wait what's the car's name? |
|
|
| Report Abuse |
|
|
24stop
|
  |
| Joined: 30 Jul 2015 |
| Total Posts: 107 |
|
| |
|