Hello. In my game, I have a carrying feature. For the most part, it works, but overall, it’s just a liability to the player’s mobility.
The player carrying the other player:
Cannot move while jumping
https://gyazo.com/fff4a7a898556a7e946b5733da7001a2
Whenever the player is near a part they are slowed down
https://gyazo.com/760a330e0cda80c09cd6986710a7cd6c
Whenever the other player dies, the one carrying them does as well
I’m not sure what I can do to really fix these problems. Any help?
I use a motor and a body gyro for this to work.
local carryMotor = ServerStorage.Models.CarryMotor:Clone()
carryMotor.Part0 = target.HumanoidRootPart
carryMotor.Part1 = root
carryMotor.Parent = root
local bodyGyro = ServerStorage.Models.GrabBg:Clone()
bodyGyro.Parent = target.HumanoidRootPart
Thanks for reading.
2 Likes
bt5191
(btt)
April 6, 2020, 12:48pm
#2
Have you SetNetworkOwnership to the player carrying the other player?
2 Likes
How would set ownership of the other player exactly?
1 Like
bt5191
(btt)
April 6, 2020, 12:56pm
#4
Read this article (don’t forget that you would set network ownership of the character, not the actual player entity).
3 Likes
varjoy
(variable)
April 6, 2020, 1:05pm
#5
SetNetworkOwnerShip
By doing this
when giving weld:
for i,v in ipairs(URmodel) do
if v:IsA("Basepart") then
v:SetNetworkOwner(Player)
end
end
Remember, the dummy parts must be anchored to make it work!
1 Like
Also, even when unanchored, it didn’t change anything.
varjoy
(variable)
April 6, 2020, 1:17pm
#7
Parts must be anchored, or it’s not going to work.
I anchored the parts and it gave me that error.
I tried to set the network ownership before the parts become anchored, and that seems to literally just anchor. Am I missing something?
for i, v in ipairs(target:GetChildren()) do
if v:IsA("BasePart") then
v:SetNetworkOwner(player)
end
end
for i, v in ipairs(target:GetChildren()) do
if v:IsA("BasePart") then
v.Anchored = true
end
end
Auhrii
(Auhrii)
April 6, 2020, 1:38pm
#10
You should not set the network ownership of anchored parts, that causes an error and anchored parts don’t necessarily have network ownership as they have no physics beyond collision detection.
What do you think I should do then?
Auhrii
(Auhrii)
April 6, 2020, 1:44pm
#12
The first code snippet you were given should be enough so long as you add an if statement to make sure the part isn’t anchored.
for _,obj in pairs(model:GetChildren) do
if obj:IsA("BasePart") and not obj.Anchored then
obj:SetNetworkOwner(Player)
end
end
Alternatively, you could just wrap it in a pcall and call it a day. Possibly ugly and people on here get shouty at you for it but it works.
for _,obj in pairs(model:GetChildren) do
if obj:IsA("BasePart") then
pcall(function() obj:SetNetworkOwner(Player) end))
end
end
1 Like
It doesn’t seem to do anything.
Auhrii
(Auhrii)
April 6, 2020, 1:47pm
#14
Are you running it in a Script, or a LocalScript?
A script. I’m doing this before putting in the motor6D, is that the problem?
Auhrii
(Auhrii)
April 6, 2020, 1:49pm
#16
That shouldn’t be an issue. At this point I suspect the other player’s client is re-asserting network ownership over their character, so trying to set it yourself would be futile. Would it be feasible to create a fake character rig for this purpose instead?
You mean the dummy I’ve been using?
Auhrii
(Auhrii)
April 6, 2020, 1:51pm
#18
My bad, I thought you were using another player’s character directly. If you’re already using a fake rig for this, I’m all out of ideas. Sorry.
1 Like
The game requires a humanoid at all times in a character, but most of the states are disabled.
1 Like
bt5191
(btt)
April 6, 2020, 11:07pm
#21
You can’t set network ownership on anchored parts because there aren’t any physics to be calculated - you set network ownership on unanchored parts.