Hi there, so basically I’m using an open-source body visible camera code, this code is major for my game as it’s first-person. I have a small camera test in my game so the player can buy a gun. Quite simple and it works without the Body Visible code. Merely it just takes the camera and locks it on a parts CFrame.
Though when I am using the Body Visible code it does its camera movement then resets, due to the Body Visible code.
I cannot figure out why though it’s probably some canceling out happening.
Body Visible Code:
local camera = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character.Humanoid
player.CameraMaxZoomDistance = 0
camera.FieldOfView = 100
humanoid.CameraOffset = Vector3.new(0, 0, -1)
for childIndex, child in pairs(character:GetChildren()) do
if child:IsA("BasePart") and child.Name ~= "Head" then
child:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
child.LocalTransparencyModifier = child.Transparency
end)
child.LocalTransparencyModifier = child.Transparency
end
end
camera:GetPropertyChangedSignal("CameraSubject"):Connect(function()
if camera.CameraSubject:IsA("VehicleSeat") then
camera.CameraSubject = humanoid
end
end)
Camera (Shop/NPC) Code:
local CurrentCamera = workspace.CurrentCamera
local TweenService = game:GetService("TweenService")
local runService = game:GetService("RunService")
local Prompt = game.Workspace.NPCRSIX.ProximityPrompt
local BackButton = game.StarterGui.ScreenGui.BackButton
CurrentCamera.CameraType = Enum.CameraType.Scriptable
local Animation = TweenService:Create(CurrentCamera, TweenInfo.new(1, Enum.EasingStyle.Exponential, Enum.EasingDirection.InOut, 0, false, 0), {["CFrame"] = workspace.REODPART.CFrame})
TEST = false
Prompt.Triggered:Connect(function(player)
task.wait(0.1)
Prompt.Enabled = false
Animation:Play()
player.Character:WaitForChild("HumanoidRootPart").Anchored = true
Animation.Completed:Wait()
runService:BindToRenderStep("NPCfocus", Enum.RenderPriority.Camera.Value + 1, function()
CurrentCamera.CFrame = CFrame.new(workspace.REODPART.Position, game:GetService("Workspace").FOCUSPART.Position)
end)
Prompt.Enabled = true
runService:UnbindFromRenderStep("NPCfocus")
player.Character:WaitForChild("HumanoidRootPart").Anchored = false
end)
Any help is much appreciated.