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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Spawn car on click

Previous Thread :: Next Thread 
Hppolice is not online. Hppolice
Joined: 06 Feb 2012
Total Posts: 578
08 Aug 2014 04:38 PM
Hello, I'm trying to creat a Spawn car on click script. I'm trying to figure out that when I click on a certain brick, the car in Lighting will duplicate it self on top of that brick, but I don't know whether it should be a model and what the outermost name should be to the inner most.

For example, I thought the Model would be called Parking Spots, then inside it is a Model called Car Holder, and 2 brick inside are called Parking Spots. Can you help me organize what goes where?

Script:

function clear()

local kid = script.Parent.Parent.Parent

local char = kid.Character:GetChildren()
for i = 1,#char do
if char[i].Name == "VS3" then
char[i]:Destroy()
end
end

local tools = kid.Backpack:GetChildren()
for i = 1,#tools do
if tools[i].Name == "Ranger" or tools[i].Name == "SS" or tools[i].Name == "Fourta" or tools[i].Name == "S5" then
tools[i]:Destroy()
end
end

local spawns = game.Workspace["Parking Spots"]:GetChildren()
for i = 1,#spawns do
if spawns[i].Name == "Car Spawn" then
local cars = spawns[i]["Car Holder"]:GetChildren()
for k = 1,#cars do
if cars[k]:FindFirstChild(kid.Name) then
cars[k]:Destroy()
end
end
end
end

end


function Select(Mouse)

Mouse.Button1Down:connect(function()
local kick = Mouse.Target
if kick ~= nil then
if kick.Name == "Car Spawn" then
clear()
local car = game.Lighting.Cars[script.Parent.Name]:clone()

local grab = kick.Parent["Car Holder"]:GetChildren()
for i = 1,#grab do
grab[i]:Destroy()
end

local tag = Instance.new("IntValue")
tag.Name = script.Parent.Parent.Parent.Name
tag.Parent = car

car:MakeJoints()
car.Parent = kick.Parent["Car Holder"]
car:MakeJoints()
car:MoveTo(kick.Position)
car:MakeJoints()

wait(1)

car.VS3.Parts.Script.Disabled = false
car.VS3.Parts.Speed.Disabled = false
car.VS3.Parts.Lights.Activated.Disabled = false
car.VS3.Parts.Lights.Director.Disabled = false
car.VS3.Parts.Doors.WeldScript.Disabled = false
car.VS3.Parts.Doors.WeldScript.Disabled = false
end
end
end)

end

script.Parent.Selected:connect(Select)


----------
Thank you for your help! I really appriciate it!
Hppolice
Report Abuse
Hppolice is not online. Hppolice
Joined: 06 Feb 2012
Total Posts: 578
08 Aug 2014 04:49 PM
bumpeh
Report Abuse
Hppolice is not online. Hppolice
Joined: 06 Feb 2012
Total Posts: 578
08 Aug 2014 04:51 PM
bumpeh[2]
Report Abuse
Sadcamp is not online. Sadcamp
Joined: 05 Nov 2010
Total Posts: 21729
08 Aug 2014 04:53 PM
like the car spawning system at USA uses?

i can dig up an old copy of usa's DC and probably get you the car regen thing as a model

screw it, i'm a penguin. i love c&g's faces. Artistically Insane. It's what's inside the machine that's brilliant.
Report Abuse
Hppolice is not online. Hppolice
Joined: 06 Feb 2012
Total Posts: 578
08 Aug 2014 04:54 PM
Yeah, does anyone have a set DC car spawn plus tools?
Report Abuse
dragonkeeper467 is not online. dragonkeeper467
Joined: 24 Jan 2011
Total Posts: 472
08 Aug 2014 04:54 PM
idk what your trying to do... to spawn a car you do something like this

function spawncar()
car = game.Lighting.car:Clone()
car:MakeJoints()
car.Parent = Workspace
car.Position = Vector3.new(0,0,0)

--any other properties can go here

end


part.OnClick:connect(spawncar())
Report Abuse
Sadcamp is not online. Sadcamp
Joined: 05 Nov 2010
Total Posts: 21729
08 Aug 2014 04:56 PM
I know I have a copy of DC somewhere, but an older version. The car spawners should pretty much be the same as they are in the modern version.

I'll go and see if I can find it.

screw it, i'm a penguin. i love c&g's faces. Artistically Insane. It's what's inside the machine that's brilliant.
Report Abuse
Hppolice is not online. Hppolice
Joined: 06 Feb 2012
Total Posts: 578
08 Aug 2014 04:56 PM
I'm trying create the brick in which the car spawns, this script should work. All I'm trying to do is create the actual brick that the car is to spawn on, and how do I do that based on this script? Do I put a model name yadayada first, or what?

Thanks for the help though.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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