Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to always be locked onto a player's head? [closed]

Asked by 5 years ago

I'm making a developer-only aimbot script for my own game so that devs can have special powers. I have this code:

1local camera = workspace.CurrentCamera
2camera.CameraType = Enum.CameraType.Scriptable
3 
4camera.CFrame=
5CFrame.new(camera.CFrame.Position,closestPlayer.Character.Head.Position)

The end result is something weird and hard to explain and it just doesn't work. I want to know how to make it so that I am in first person and the middle of my screen is locked on to the player's head but I can move around normally. Thanks in advance!

0
use the Z coordinate DeceptiveCaster 3761 — 5y

Closed as Non-Descriptive by hiimgoodpack and maumaumaumaumaumua

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 5 years ago
1local camera = workspace.CurrentCamera
2camera.CameraType = Enum.CameraType.Scriptable
3 
4 
5 
6while wait()do
7    local cframe = CFrame.new(game.Players.LocalPlayer.Character.Head.Position ,workspace.Dummy.UpperTorso.Position)
8    camera.CFrame= cframe + (cframe.LookVector*2)
9end
Ad