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 » Scripters
Home Search
 

Re: help on cloning script

Previous Thread :: Next Thread 
24stop is not online. 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
AdamHighDefinition is not online. AdamHighDefinition
Joined: 09 Aug 2015
Total Posts: 628
23 Aug 2015 09:15 AM
Show u the script then
Report Abuse
24stop is not online. 24stop
Joined: 30 Jul 2015
Total Posts: 107
23 Aug 2015 09:40 AM
?


bump1
Report Abuse
8BitRetroGamer is not online. 8BitRetroGamer
Joined: 09 Mar 2013
Total Posts: 3546
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 is not online. 24stop
Joined: 30 Jul 2015
Total Posts: 107
23 Aug 2015 10:34 AM
Hey. That script didn't work. :(
Report Abuse
8BitRetroGamer is not online. 8BitRetroGamer
Joined: 09 Mar 2013
Total Posts: 3546
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 is not online. 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 is not online. 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
8BitRetroGamer is not online. 8BitRetroGamer
Joined: 09 Mar 2013
Total Posts: 3546
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 is not online. 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 is not online. 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
8BitRetroGamer is not online. 8BitRetroGamer
Joined: 09 Mar 2013
Total Posts: 3546
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 is not online. 24stop
Joined: 30 Jul 2015
Total Posts: 107
23 Aug 2015 01:35 PM
didn't work either. :/
Report Abuse
24stop is not online. 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
8BitRetroGamer is not online. 8BitRetroGamer
Joined: 09 Mar 2013
Total Posts: 3546
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 is not online. 24stop
Joined: 30 Jul 2015
Total Posts: 107
24 Aug 2015 08:11 AM
didn't work



bump
Report Abuse
SkySpell is not online. SkySpell
Joined: 01 Sep 2008
Total Posts: 1581
24 Aug 2015 08:26 AM
Wait what's the car's name?
Report Abuse
24stop is not online. 24stop
Joined: 30 Jul 2015
Total Posts: 107
24 Aug 2015 10:32 AM
Car
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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