Answered by
XAXA 1569
9 years ago
The problem in your script lies at line 16
: You're assuming that Blocky
is always created before the script runs, when in fact this isn't the case. According to a conversation we had, Blocky
is added to the player immediately after spawning, and the script runs also immediately after spawning.
Solution
You don't even have to iterate through the player's Torso
. To fix this, use WaitForChild("name")
. WaitForChild("name")
yields the current thread (pauses the script) until a child with a matching name is found. The child is then returned.
01 | local Players = game:GetService( "Players" ) |
02 | local lplayer = Players.LocalPlayer |
03 | repeat wait() until lplayer.Character |
04 | local Torso = lplayer.Character:WaitForChild( "Torso" ) |
05 | local Blocky = Torso:WaitForChild( "Blocky" ) |
07 | local cam = workspace.CurrentCamera |
09 | cam.CameraSubject = Torso |
10 | cam.CameraType = "Scriptable" |
14 | cam.CoordinateFrame = CFrame.new(Blocky.Position) * CFrame.Angles( 0 , angle, 0 ) * CFrame.new( 0 , 0 , 5 ) |
15 | angle = angle + math.rad( 1 ) |