of     1   

FroggoBLOX
#141813349Monday, July 28, 2014 5:45 AM GMT

repeat wait() until game.Players.LocalPlayer local player = game.Players.LocalPlayer local mouse = player:GetMouse() repeat wait() until player.Character local torso = player.Character.Torso while wait() do torso.CFrame.LookVector = Vector3.new(mouse.Hit.p.X,0,mouse.Hit.p.Z) end Trying to make the character always look where the player's mouse is. This is my first time dealing with LookVector though, and I believe that it might be read only. If it is how do I fix this script?
swmaniac
#141813774Monday, July 28, 2014 5:50 AM GMT

First, "repeat wait() until game.Players.LocalPlayer" is: 1) Busy-waiting (very very inefficient) 2) Unnecessary. There should be no situation where a localscript is running and LocalPlayer is nil. Next, "repeat wait() until player.Character" This is at least necessary, but is still busy-waiting. Consider player.CharacterAdded:wait() This will allow the script to simply wait until the character is added, rather than checking every frame. Lastly, lookVector is indeed read-only. Consider using CFrame.new(Vector3 OriginalPosition, Vector3 TargetPosition) to make a CFrame "looking at" a target.

    of     1