Is there a method to apply impulse on a player character on the server without using events? I have set the player’s HumanoidRootPart network to nil which means the server has network ownership but isn’t working. Do I have to loop through every descendant of the player and set its network ownership to the server?
A simple for loop that skips over anything that isn’t a BasePart should do the job:
for _, part in pairs(Character:GetChildren()) do
if not part:IsA("BasePart") then continue end -- skips anything that isn't a part
part:SetNetworkOwner(nil)
end
I did that too but applying impulse doesn’t do anything. But when I reset and the server gets network ownership of the player’s character then the impulse gets used even though a lot of time has passed.
Heres the function I made/used before this:
local function SetNetworkOwner(Character:Model, Owner:Player?)
for I, X in pairs(Character:GetDescendants()) do
if not X:IsA("BasePart") then continue end
X:SetNetworkOwner(Owner)
end
end
Is the impulse attempting to be applied to the previous character before respawning?
If so, you might want to update whatever variable is being used for the current character using
local character
Player.CharacacterAdded:Connect(function(char)
character = char
end)
That way, the script will know whenever the character respawns and assign the variable to the new model
It’s a grab-type ability so the network owner is set only for a brief period. I set the network owner of everyone caught to nil then when I apply the impulse I wait for a second and then reset the network owner. I don’t want the server to have full network ownership.
If it’s an ability that a player is using to influence another player’s character, I don’t think there’s really a way to let Player1 move Player2 around and manipulate them without some client-server communication using RemoteEvents.
The client would fire the grabbed player to the server, and then the server does all the sanity checking (is the player close enough? Can Player2 get grabbed or are they invulnerable? etc.) before actually applying the impulse.
I don’t know if one player would be able to control another’s character directly using NetworkOwnership. If there is a way, it probably revolves around some means of exploiting client-server communication.
Edit: I could also just be misunderstanding what you’re trying to accomplish to be perfectly clear lmao
Yeah, mb I didn’t give enough context but this should be enough. The ability set is in a module on the server so that certain npc’s can use these abilities as well. If it was another player using the moves then it’s fine but if it’s an NPC using them it’s a problem you see?
Edit: Also the ability can catch multiple characters from players to npc’s
OH ok.
Well, I’m not sure that NetworkOwnership matters when it comes to the server manipulating character CFrames/applying impulses to them.
You can always just skip over changing ownership if the ability is being used by an NPC housed on the server.
The server is usually the primary controller of everything that exists universally in-game. It shouldn’t matter if one player “owns” a part, if the server wants to do something with it, and it wasn’t created with a LocalScript, then it should just kinda be able to.
A player can move their character and do other things like setting the walk speed because the player has network ownership over their character. Network ownership allows for the owner to decide the physics and in this case, because the player has the network ownership the server can’t do anything physics-related to it.
Edit: Also, telling me to remove the network ownership part brings us back to step 0 because that’s what I did when I posted this and it wasn’t working.
Is the player using an ability on an NPC, or is an NPC using it on a player? I was assuming the latter.
If a player wants to manipulate a server NPC and it isn’t working, but works with manipulating other players, then I’m honestly lost and I’m sorry for wasting your time lmao
Its Npc on player or player on player or player on npc
Right. I understand that much, I was just saying that I got no clue how to help lol. I gave it a shot
Oh, then thx for your time and effort to help me solve this
Bump. I need this resolved soon