|
| 20 Aug 2016 08:05 PM |
Hello!
I am working on a racing game, and i have a few questions.
How can i script a shop and you can select a car, Then when the race starts, The car that you selected will be spawned in the race tracks.
Also, No. I'm not asking anyone to make a script for me.
I am just asking how can i script it myself. |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2016 08:07 PM |
local backup = car car.Parent = game.ReplicatedStorage
local cars = { ["GT 500"] = car }
function spawncar(t) local chosen = cars[t] if chosen then local new = chosen:Clone() new.Parent = something new:SetPrimaryPartCFrame(the spawnpoint cframe) end end |
|
|
| Report Abuse |
|
|
| |
|
|
| 20 Aug 2016 08:15 PM |
if you learn what dictionaries are you can use them to store information in the form of variables inside of a table
so if you did
spawncar("GT 500")
it would get
cars["GT 500"] which will be your car |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2016 08:19 PM |
| Yes, But How can the player select the car from the shop? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
pullman45
|
  |
| Joined: 09 Jul 2012 |
| Total Posts: 2891 |
|
| |
|
| |
|
Kervos
|
  |
| Joined: 27 Aug 2015 |
| Total Posts: 322 |
|
| |
|
|
| 21 Aug 2016 12:01 AM |
| I know, But i'm asking a scripting question. = = |
|
|
| Report Abuse |
|
|
Kervos
|
  |
| Joined: 27 Aug 2015 |
| Total Posts: 322 |
|
| |
|
|
| 21 Aug 2016 12:28 AM |
| Again, I'm not asking for help about GUIs, I am asking help about scripting. |
|
|
| Report Abuse |
|
|
|
| 21 Aug 2016 12:28 AM |
bruh call the function with the selected car
:) |
|
|
| Report Abuse |
|
|
|
| 21 Aug 2016 12:34 AM |
| Yeah i know, I'm scripting right now. |
|
|
| Report Abuse |
|
|