|
| 05 Mar 2013 11:30 PM |
I'm trying to make a script that'll spawn a model from Lighting, move it the the model that has this script in it.. Get the spawned model's name and move it father.. I'm stuck at SP, I don't know how to check the model's name and then move it.. Thought I had it right, but I guess not. So now I'm stuck right at "local SP", don't want what I'm suppose to do now.
wait(.1) local MapPart = Instance.new("Model") MapPart.Parent = script.Parent.Parent MapPart.Name = "SpawnedPartName" print("spawning map peice") maps = game.Lighting.Maps:GetChildren() randmap=maps[math.random(1, #maps)] for i=1,#maps do if maps[i]==randmap then c=maps[i]:Clone() c.Parent=script.Parent.Parent.SpawnedPartName c:MoveTo(script.Parent.Position) c:TranslateBy(Vector3.new(0,0,-.5)) wait(.2) --Just to make sure the model spawns. c:TranslateBy(Vector3.new(0,-10.4,0)) wait() local SP = script.Parent.Parent.SpawnedPartName:GetChildren() --stuck here. if SP = Straight then c:TranslateBy(Vector3.new(0,-10.4,0)) elseif SP = Corner then c:TranslateBy(Vector3.new(0,-20.4,0)) elseif SP = Tsection then c:TranslateBy(Vector3.new(0,-30.4,0)) print("moving") end end end
Help please. |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2013 01:46 AM |
I don't understand why you have if SP = Straight then
For a start you need;
if SP == Straight then
But I also can't see where SP shows Straight Corner or Tsection. |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2013 03:10 PM |
| That's what I'm trying to do... get the script to check SP to see what its child is, then move its child on one of the select options.. |
|
|
| Report Abuse |
|
|
| |
|
|
| 06 Mar 2013 05:24 PM |
| First of all, Straight is not a falled callback function, or a property. Second, you have major script errors and you are missing lots of lines of code. |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2013 07:13 PM |
| Would you be helpful by telling me what im missing? Cause that's the code I wrote, nothing missing. thats the complete script. |
|
|
| Report Abuse |
|
|