Helmet Camera Bug

I need help to make a helmet camera:
My camera is bugged (look at the video).

I changed the camera type to scriptable but, this change nothing.

I want to make the camera like the start but with the camera part position.

Here’s the code:

local part = script.Parent
local camera = game.Workspace.CurrentCamera
local show = script.Parent

camera.CameraSubject = show

The video:

robloxapp-20240203-2046246.wmv (2.7 MB)

Hi! Try this

local Character = game.Players.LocalPlayer.Character
local part = script.Parent
local cam = workspace.CurrentCamera
local x

cam.CameraSubject = part
cam.CameraType = Enum.CameraType.Scriptable

x = game["Run Service"].RenderStepped:Connect(function()
	cam.CFrame = part.CFrame
end)

To stop this, you just need to:

x:Disconnect()
cam.CameraSubject = Character.Humanoid
cam.CameraType = Enum.CameraType.Fixed
1 Like

Thanks that’s a bit better but I still can’t move the camera.
robloxapp-20240203-2134398.wmv (552.3 KB)

Not a problem! Just wait some time I need to do a script!

Try this:

local plr = game.Players.LocalPlayer
repeat wait() until plr.Character ~= nil
local char = plr.Character
local runService = game:GetService("RunService")
local input = game:GetService("UserInputService")
local Sensitivity = 0.2
local Smoothness = 0.05
local cam = workspace.CurrentCamera
local m = plr:GetMouse()
local part = script.Parent

local CamPos,TargetCamPos = cam.CoordinateFrame.p, cam.CoordinateFrame.p
local AngleX,TargetAngleX = 0,0
local AngleY,TargetAngleY = 0,0

input.InputChanged:connect(function(inputObject)
	if inputObject.UserInputType == Enum.UserInputType.MouseMovement then
		local delta = Vector2.new(inputObject.Delta.x/Sensitivity,inputObject.Delta.y/Sensitivity) * Smoothness

		local X = TargetAngleX - delta.y 
		TargetAngleX = (X >= 80 and 80) or (X <= -80 and -80) or X 
		TargetAngleY = (TargetAngleY - delta.x) %360 
	end
end)

runService.RenderStepped:connect(function()
	CamPos = CamPos + (TargetCamPos - CamPos) *0.28
	AngleX = AngleX + (TargetAngleX - AngleX) *0.35
	local dist = TargetAngleY - AngleY
	dist = math.abs(dist) > 180 and dist - (dist / math.abs(dist)) * 360 or dist
	AngleY = (AngleY + dist *0.35) %360
	cam.CameraType = Enum.CameraType.Scriptable

	cam.CoordinateFrame = CFrame.new(part.Position)
		* CFrame.Angles(0,math.rad(AngleY),0)
		* CFrame.Angles(math.rad(AngleX),0,0)
		* CFrame.new(0,0.8,0)
end)

I’m sorry to take your time but this time, this more bugged:
robloxapp-20240203-2147538.wmv (481.9 KB)

hm, try to paste after

runService.RenderStepped:connect(function()

in next line this:

game.UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter

The render:

The camera:

image

Where’s the helmet?

can you send me full script please?

local plr = game.Players.LocalPlayer
repeat wait() until plr.Character ~= nil
local char = plr.Character
local runService = game:GetService("RunService")
local input = game:GetService("UserInputService")
local Sensitivity = 0.2
local Smoothness = 0.05
local cam = workspace.CurrentCamera
local m = plr:GetMouse()
local part = script.Parent

local CamPos,TargetCamPos = cam.CoordinateFrame.p, cam.CoordinateFrame.p
local AngleX,TargetAngleX = 0,0
local AngleY,TargetAngleY = 0,0

input.InputChanged:connect(function(inputObject)
	if inputObject.UserInputType == Enum.UserInputType.MouseMovement then
		local delta = Vector2.new(inputObject.Delta.x/Sensitivity,inputObject.Delta.y/Sensitivity) * Smoothness

		local X = TargetAngleX - delta.y 
		TargetAngleX = (X >= 80 and 80) or (X <= -80 and -80) or X 
		TargetAngleY = (TargetAngleY - delta.x) %360 
	end
end)

runService.RenderStepped:connect(function()
	CamPos = CamPos + (TargetCamPos - CamPos) *0.28
	AngleX = AngleX + (TargetAngleX - AngleX) *0.35
	local dist = TargetAngleY - AngleY
	dist = math.abs(dist) > 180 and dist - (dist / math.abs(dist)) * 360 or dist
	AngleY = (AngleY + dist *0.35) %360
	cam.CameraType = Enum.CameraType.Scriptable

	cam.CoordinateFrame = CFrame.new(part.Position)
		* CFrame.Angles(0,math.rad(AngleY),0)
		* CFrame.Angles(math.rad(AngleX),0,0)
		* CFrame.new(0,0.8,0)
end)

runService.RenderStepped:connect(function()
	game.UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
end)
1 Like

can you add me in ur place? My nickname: Nextinel1. This acc (Nextinel2) for DevForum only

you need to be my freind to access the map, I sent you a request, MrCrayfisho

alright, done, so, now add me in ur place

image

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.