"Can only call Network Ownership API on a part that is descendent of Workspace"

So basically, I’ve been for the past 3 months making a game called psycho
And everything’s been working… Until now.

Basically, what I’ve been trying to do is to set the network ownership of the player then use assembly linear velocity to dash the player in the camera’s direction but for some reason it stopped working

and this error called “Can only call Network Ownership API on a part that is descendent of Workspace” has only started appearing NOW

So, if there’s a way to fix it or another way to make the player dash forward in the camera’s direction, it’d be much appreciated if you could help.

Heres the code:

P.S: the variables are indeed correct and working fine

 local Dash = {}

function Dash.Trigger(Player, Character, DashSpeed, CameraVector)
	if Character then
	if Character:FindFirstChild("HumanoidRootPart") then
		
local HrPart = Character.HumanoidRootPart
local Humanoid = Character:FindFirstChild("Humanoid")
HrPart:SetNetworkOwner(nil)

	HrPart.AssemblyLinearVelocity = (CameraVector * DashSpeed)

	HrPart:SetNetworkOwner(Player)
	end
	end
end
return Dash

The error “Can only call Network Ownership API on a part that is a descendant of Workspace” is because the humanoidrootpart is not properly parented to the workspace when setnetworkowner is called. Ensure that the character and its humanoidrootpart are valid and properly parented to the workspace before setting the network ownership.

1 Like

I’ve actually tried that solution as well, forgot to mention it. The humanoid root part didnt even end up in the workspace despite me parenting it but i’ll try it again.

1 Like

Then the problem might be in the timing or context of when the SetNetworkOwner is called. Check if the character and its parts are fully loaded and initialized before attempting to modify network ownership.

I’ve tried parenting and that doesnt work but ill also try that as well.
oh what i meant by doesnt work is that it doesnt display an error message but the velocity doesnt set

1 Like

Hm, then consider applying the dash force using a bodyvelocity or bodymover directly to the humanoidrootpart , which can probably avoid problems and ensure consistent movement in the camera’s direction.

1 Like

I’ve tried that as well, Bodyvelocity doesnt even have its parent set for some reason. But ill see if i can get body movers working

1 Like

Doesnt seem to be working because parent doesnt change at all

local V = Instance.new("VectorForce", HrPart)
V.Force = (CameraVector * DashSpeed)
V.Attachment0 = HrPart.RootAttachment
1 Like

You need to explicitly assign the parent after creating the instance and check if the humanoidrootpart exists and is in the workspace.


local V = Instance.new("VectorForce")
V.Force = CameraVector * DashSpeed
V.Attachment0 = HrPart:FindFirstChild("RootAttachment") -- Ensure the attachment exists
V.Parent = HrPart -- Explicitly set the parent

1 Like

It didn’t work either

edit: Ig this post is a lost cause now

1 Like

Ok so the solution was actually changing the body type to r15??
Goes against my game but ill try to think of some other solution

Turns out the other solution was also just re-defining the character’s variable everytime the character presses q because the character would die 3 seconds in right after loading (thats cause of my game) and bassically in other words delete the character variable despite it being correct and printing properly

1 Like

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