I’m trying to make a simple lock-on system for my game, everything was going smoothly until I tried to make the character face the part locked onto.
The whole rotation aspect works fine, however it makes the player unable to move. Not sure if I’m just being dumb here or what, here’s the script;
local players = game:GetService("Players")
local player = players:GetPlayerFromCharacter(character)
while wait() do
print(player.LockOn.Value)
print(tostring(player.LockOn.Value))
if tostring(player.LockOn.Value) ~= "nil" then
print("A")
character.Humanoid.AutoRotate = false
local lockedplayer = player.LockOn.Value
print(lockedplayer.PrimaryPart.Position)
player.Character:SetPrimaryPartCFrame(CFrame.new(player.Character.Torso.Position, lockedplayer.PrimaryPart.Position))
end
end
I’ve tried replacing Character.Torso with Character.PrimaryPart, which made no difference.