So i made a script that changes your CFrame of the Camera to players head, is there any way i can make it follow the players head.
Here is the script:
local plr = game.Players.LocalPlayer
local Camera = game.Workspace.CurrentCamera -- Getting the Camera
local player = game.Players.LocalPlayer
game:GetService("UserInputService").InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.F then
repeat wait() until player.Character
Camera.CameraType = "Scriptable"
Camera.CFrame = player.Character.Head.CFrame
Camera.CameraSubject = player.Character.Head
end
end)
Okay, I found the problem! Here is my code, hope it helps all I did was change the mode to track and make CameraMaxZoomDistance to 0
local plr = game.Players.LocalPlayer
local Camera = game.Workspace.CurrentCamera -- Getting the Camera
local player = game.Players.LocalPlayer
game:GetService("UserInputService").InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.F then
repeat wait() until player.Character
plr.CameraMaxZoomDistance = 0
Camera.CameraType = Enum.CameraType.Attach
Camera.CFrame = player.Character.Head.CFrame
Camera.CameraSubject = player.Character.Head
end
end)
yoo it worked tsym. Also is there anyway i can reset all the settings to normal if the F is key pressed again, i tried using inputended but it didnt work.
local plr = game.Players.LocalPlayer
local Camera = game.Workspace.CurrentCamera -- Getting the Camera
local player = game.Players.LocalPlayer
isin = false
game:GetService("UserInputService").InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.F then
if isin == false then
print("Yes")
isin = true
repeat wait() until player.Character
plr.CameraMaxZoomDistance = 0
Camera.CameraType = Enum.CameraType.Attach
Camera.CFrame = player.Character.Head.CFrame
Camera.CameraSubject = player.Character.Head
else
print("No")
Camera.CameraType = Enum.CameraType.Custom
plr.CameraMaxZoomDistance = 50
Camera.CFrame = plr.Character.HumanoidRootPart.CFrame
Camera.CameraSubject = plr.Character.Humanoid
isin = false
end
end
end)
Don’t worry about print statements and other variables there just for testing,