hi, I am making my own camera for a game but I have a problem and that is that when the player just enters the game he can drag the normal camera but when the player dies it is impossible to drag the camera and I don’t know how I could fix it
everything works but when the player dies that bug appears or also when the player appears it rarely appears already with the bug done
my code here:
player.CharacterAdded:Connect(function()------------------------------------detect new character
camera.CameraType = Enum.CameraType.Scriptable
print("scriptable")
----------------------------------------------------------------------------------player locals
local char = player.Character
local head = char:WaitForChild("Head")
local root = char:WaitForChild("HumanoidRootPart")
local hum = char:WaitForChild("Humanoid")
local ChangeCamera = char:WaitForChild("CameraSystemLocal"):FindFirstChild("ChangeCamera")
local x = 0
local y = 0
local function mouseMove(name, state, inputObject)
x = x + (-inputObject.Delta.x*config.Sens/100)
y = y + (-inputObject.Delta.y*config.Sens/100)
if (y > config.snap) then
y = config.snap
elseif (y < -config.snap) then
y = -config.snap
end
end
game:GetService("ContextActionService"):BindActionToInputTypes("MouseMove", mouseMove, false, Enum.UserInputType.MouseMovement)
runs:BindToRenderStep("CameraUpdate", Enum.RenderPriority.Camera.Value, function(dt)
config.offx = script:WaitForChild("xoffset").Value
config.zoom = script:WaitForChild("zoom").Value
config.mousezoom = script:WaitForChild("mousezoom").Value
camera.CFrame = CFrame.new(root.Position) * CFrame.Angles(0, x, 0) * CFrame.Angles(y, 0, 0) -- rotate around player
if Aiming == false then
config.Sens = customSens
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Elastic,Enum.EasingDirection.Out,0, false,0)
tween:Create(script.zoom, tweenInfo, {Value = config.mousezoom}):Play()
tween:Create(script.xoffset, tweenInfo, {Value = 0}):Play()
camera.CFrame = camera.CFrame * CFrame.new(config.offx, config.offy, config.zoom)
end
end)
end)