Multiplayer Problem

While I was playing testing my game on my alt including me, I stumbled upon this error right here


"HumanoidRootPart is not a valid member of Model “Workspace.cupcake_BoyzCary”
It happened to be the local script I was making. On my other device it worked normally. So I didn’t know if this happens randomly or if it’s my script’s issue. If anyone is willing to help, I would like that.
This is the script ive been using

local ts = game:GetService("TweenService")
local parttarget = workspace:WaitForChild("LookCamTarget")
local camera = workspace.CurrentCamera

local tweeninfo = TweenInfo.new(
	3,
	Enum.EasingStyle.Cubic,
	Enum.EasingDirection.InOut,
	0,
	false,
	0
)
--moves camera to the lookcam target
local tween2 = ts:Create(camera, tweeninfo, {CFrame = parttarget.CFrame})
local event = game.ReplicatedStorage.Events:WaitForChild("GateOpen")
event.OnClientEvent:Connect(function(player: Player)
	camera.CameraType = Enum.CameraType.Scriptable --camera settings
	player.Character.HumanoidRootPart.Anchored = true --error with multiplayer
	--player becomes invisible smoothly
	local tweeninfo2 = TweenInfo.new(
		0.75,
		Enum.EasingStyle.Cubic,
		Enum.EasingDirection.InOut,
		0,
		false,
		0
	)
	for i, v in pairs(player.Character:GetDescendants()) do
		if v:IsA("MeshPart") then
			local tween1 = ts:Create(v, tweeninfo2, {Transparency = 1})
			tween1:Play()
		end
		tween2:Play()
	end
end)

Yeah I posted several times about this script…

try replacing it with this:

local HRP = player.Character:FindFirstChild("HumanoidRootPart")

if HRP then
HRP.Anchored = true
end

Or it might be that your receiving the player wrong, If you can, please provide your server script.

Note:

I would recommend doing camera things on the client and the tweening on the server, so everybody sees it, that may also be one of the factors.

The multiplayer camera works already.

For starters, id print the humanoidrootpart and if its nil go print the parent, we can click on the output what has the server selected from the explorer

We also need to see how the data is being send

Okay wait i saw the screenshot a bit closer, it looks like your local script is receiving the player of another player.

If the event is being fired multiple times, you should do sanity checks
(If player that is sent from the event isnt equal to the player that is receiving it then return to stop the script)

1 Like