|
| 13 Jul 2014 12:21 PM |
It says Workspace.Script:10: attempt to index local 'ob' (a nil value) Did I do CFrame wrong?
game.Workspace.ChildAdded:connect(function(object) local player = game.Players:playerFromCharacter(object) if player ~= nil then local lvl = player.leaderstats.Level.Value print(lvl) local ob = game.Workspace:FindFirstChild("Level"..lvl) print(ob) object.Torso.CFrame = object.Torso.CFrame + Vector3.new(0,3,0) wait() object.Torso.CFrame = ob.CFrame + Vector3.new(0,3,0) end end) |
|
|
| Report Abuse |
|
|
| |
|
Vuva
|
  |
| Joined: 22 Jan 2010 |
| Total Posts: 1102 |
|
|
| 13 Jul 2014 12:42 PM |
| is "print(ob)" returning nil? because that is the problem I'm pretty sure... |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 12:51 PM |
no object.Torso.CFrame = ob.CFrame + Vector3.new(0,3,0) is returning nil |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 12:53 PM |
Workspace.Script:10: attempt to index local 'ob' (a nil value)
The problem is what it is...
It's attempting to find ob but ob's nil...
"object.Torso.CFrame = ob.CFrame + Vector3.new(0,3,0) is returning nil" It's not returning anything, you're setting a value here |
|
|
| Report Abuse |
|
|
| |
|
|
| 13 Jul 2014 12:58 PM |
| But what should I do then? |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 01:04 PM |
| Find out why "local ob = game.Workspace:FindFirstChild("Level"..lvl)" is nil |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 01:09 PM |
| I have no clue. It prints lvl correctly and the part named Level 1 is there so idk :| |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 01:10 PM |
| maybe you're missing a space |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 01:21 PM |
Wow back to bed haha :| But now I get
Workspace.Script:8: bad argument #3 to 'CFrame' (CFrame expected, got userdata) |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 01:22 PM |
| nvm fixed thanks for the help |
|
|
| Report Abuse |
|
|