CarlosMX
|
  |
| Joined: 30 Apr 2011 |
| Total Posts: 791 |
|
|
| 22 Mar 2014 07:12 PM |
This is my first time working with SaveInstance and LoadInstance. So please help me out here, I'm trying to get this script to load a car into another model when a player joins.
game.Players.PlayerAdded:connect(function(player) if player:WaitForDataReady() then if player.TeamColor == BrickColor.new("Bright green") then game.Lighting.Startinggrid.Cars.Green:Destroy() player:LoadInstance("Car").Name = "Green" player:LoadInstance("Car").Parent = game.Lighting.Startinggrid.Cars end end end) |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2014 07:13 PM |
Take out if player:WaitFor-- And change to
player:WaitForDataReady()--will wait until data is ready,no ifs
And then
if player:LoadInstance("Car")~=nil then |
|
|
| Report Abuse |
|
|
CarlosMX
|
  |
| Joined: 30 Apr 2011 |
| Total Posts: 791 |
|
|
| 22 Mar 2014 07:15 PM |
| Changed that, so the rest of it should work?? |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2014 07:17 PM |
change
player:LoadInstance("Car").Name = "Green" player:LoadInstance("Car").Parent = game.Lighting.Startinggrid.Cars
to
local car = player:LoadInstance("Car") car.Name = "Green" car.Parent = game.Lighting.Startingrid.Cars |
|
|
| Report Abuse |
|
|
DataStore
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 8540 |
|
|
| 22 Mar 2014 07:18 PM |
@Island, Actually doing it how he did, with WaitForDataReady (if statement), would work perfectly fine and may be seen as better. The method mentioned will "pause" the script until their data is ready or until a certain amount of time has elapsed, regardless of whether or not their data is ready.
|
|
|
| Report Abuse |
|
|
CarlosMX
|
  |
| Joined: 30 Apr 2011 |
| Total Posts: 791 |
|
|
| 22 Mar 2014 08:20 PM |
| it doesn't clone the model into the game... |
|
|
| Report Abuse |
|
|
CarlosMX
|
  |
| Joined: 30 Apr 2011 |
| Total Posts: 791 |
|
| |
|