Error with loading character

there’s something wrong with my game, which i cant identify the problem

sometimes when ever i want to test the game this happens


and i think it has to do with this script or the other

local players = game:GetService("Players")
local plr = players.LocalPlayer
local runservice = game:GetService("RunService")
local camera = workspace.CurrentCamera

-- Set the camera type to Scriptable once
camera.CameraType = Enum.CameraType.Scriptable

runservice:BindToRenderStep("Camera", 100000, function()
	local char = plr.Character
	if char then
		local tab = {"Head", "HumanoidRootPart"}
		for i, limb in pairs(char:GetChildren()) do
			if limb and limb:IsA("BasePart") then
				if not table.find(tab, limb.Name) then
					limb.Transparency = 0
					limb.LocalTransparencyModifier = 0
				end
			end
		end
	end
end)

runservice.RenderStepped:Connect(function(step)
	local char = plr.Character
	if char then
		local ray = Ray.new(char.Head.Position, ((char.Head.CFrame + char.Head.CFrame.LookVector * 2) - char.Head.Position).Position.Unit)
		local ignoreList = char:GetChildren()

		local hit, pos = game.Workspace:FindPartOnRayWithIgnoreList(ray, ignoreList)

		char.Humanoid.CameraOffset = Vector3.new(0, 0, -(char.Head.Position - pos).magnitude)
	end
end)

or this one

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local event = ReplicatedStorage:WaitForChild("MouseFollowFunctionEvent")
local cam = workspace.CurrentCamera

local function rotateShoulder(shoulder, lookVector) 
	local shoulderC0 = shoulder.C0
	local shoulderpos = shoulderC0.Position
	local angleX = lookVector.X
	local angleY = lookVector.Y
	
	if angleX <= math.rad(-90) then
		angleX = math.rad(-90)
	end

	shoulder.C0 = CFrame.new(shoulderpos) * CFrame.Angles(angleY, 0, 0)
end

event.OnServerEvent:Connect(function(player, lookVector)
	local char = player.Character
	if not char then return end

	local RUA = char:FindFirstChild("RightUpperArm")
	local shoulder = RUA["RightShoulder"]

	if RUA then
		local tool = char:FindFirstChildWhichIsA("Tool")
		if tool then
			rotateShoulder(shoulder, lookVector)
		else
			rotateShoulder(shoulder, Vector3.new(0, 0, 0)) -- Reset rotation if no tool
		end
	end
end)
local event = game.ReplicatedStorage.MouseFollowFunctionEvent
local player = game.Players
local runservice = game:GetService("RunService")
local cam = workspace.CurrentCamera

local function checkmouseforany()
	local angle = cam.CFrame.LookVector
	event:FireServer(angle)
end

runservice.RenderStepped:Connect(checkmouseforany)
1 Like

any help would be appreciated as im stills stuck

im still awaiting for a reaspond, any help would be the most

How often does the issue occur?

Does disabling either of the scripts stop it from happening?

If you look in explorer when it’s glitched, is the character there? If so, what position does it get moved to?

(btw I would recommend against having FireServer happen that often. I feel like it is going to cause lag)

it occurs if i just start testing, but when i test again it doesnt happen,

Can you please provide answers to the other questions in my post?

ok i will be right back, let me test it

for the 2nd question, yes it stops it from happening, so its probably the 2 scripts i mensoned

yes the character is there, and no it didnt move at all, it has to do with the camera cframe

is this normal for the camera focus position to be “0, -14.142, -14.142”

Which of the 2 scripts?

the `local players = game:GetService(“Players”)
local plr = players.LocalPlayer
local runservice = game:GetService(“RunService”)
local camera = workspace.CurrentCamera

– Set the camera type to Scriptable once
camera.CameraType = Enum.CameraType.Scriptable

runservice:BindToRenderStep(“Camera”, 100000, function()
local char = plr.Character
if char then
local tab = {“Head”, “HumanoidRootPart”}
for i, limb in pairs(char:GetChildren()) do
if limb and limb:IsA(“BasePart”) then
if not table.find(tab, limb.Name) then
limb.Transparency = 0
limb.LocalTransparencyModifier = 0
end
end
end
end
end)

runservice.RenderStepped:Connect(function(step)
local char = plr.Character
if char then
local ray = Ray.new(char.Head.Position, ((char.Head.CFrame + char.Head.CFrame.LookVector * 2) - char.Head.Position).Position.Unit)
local ignoreList = char:GetChildren()

	local hit, pos = game.Workspace:FindPartOnRayWithIgnoreList(ray, ignoreList)

	char.Humanoid.CameraOffset = Vector3.new(0, 0, -(char.Head.Position - pos).magnitude)
end`

and the rest of the script i send