Hello. I’m making a custom character rig for my game that’s physics-based, and sometimes the character gets stuck in place for a few inputs. I don’t know why this is happening, and I don’t know what to try to fix it. There are no errors and everything else about the character is working as intended. Does anybody know what’s happening?
Check if it is not anchored on it
Everything is unanchored, problem still persists.
Is there any script to it is there is show me
There is no script within the character if that’s what you’re wondering.
Hmm, several questions, are you using Humanoids within your character?
If so did you set the hipheight appropriately and enabling physics mode of the humanoid?
If you are using pure forces than what does your movement script look like? Are you applying enough force?
I’m using a humanoid. The hip height is set to the correct height, maybe a teeny tiny bit to tall. I don’t know what physics mode is in humanoids.
Ok then I bet the issue is server ownership. You need to give the player local control of the physics based limbs in order for the player to be able to control it fully.
I don’t really understand what that means. I know what server and client side means, but I don’t see how a player wouldn’t have full control over their character. The character is basically just a ragdoll connected to the humanoid root part, they’re not actually controlling it. But, either way, how do I do that?
Oh, that raises my suspicion even further as this would mean there is a chance the server is controlling the ragdoll’s movement hence the player will not be able to control the movement. They will basically fight each other with a delay due to latency lag.
To fix this when you attach the player the ragdoll on character added maybe then in a server script set network ownership of the base parts to the player using this function. Model is a model you wish to give and owner is the player instance.
local function giveModelToPlayer(model, owner)
local descendants = model:GetDescendants()
for index, descendant in pairs(descendants) do
if descendant:IsA("BasePart") then
descendant:SetNetworkOwner(owner)
end
end
end
Okay, so do I fire that function when the player is added or when the character is added? Also, where do I put the Script?
I’m using my experience from the roblox tutorial on how to make a custom starter character which is in case the space ship for an arcade game.
This is what they use in order to give network ownership of the parts of the spaceship in the tutorial within server scripts as it can only be done server sided for transferring network ownership.
--This script handles ship behavior on the server-side of the game
-- Called when the character is added
local function onCharacterAdded(character)
local rootPart = character:WaitForChild("HumanoidRootPart")
-- Wait until rootPart is part of the workspace
while not rootPart:IsDescendantOf(workspace) do
wait()
end
-- Gives control of the ship to the player
rootPart:SetNetworkOwner(game.Players:GetPlayerFromCharacter(character))
end
-- Called when a player is added to the game
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterAdded)
end
-- Connect onPlayerAdded() to the PlayerAdded event.
game.Players.PlayerAdded:Connect(onPlayerAdded)
I put the code you gave into a server script and placed it in the workplace, now the problem is even worse.
Was I supposed to make it local instead of server or something?
Sorry, but I have no idea what is happening in your workspace. By the way the code above only gives network ownership of the root part. In your case you need to give network ownership of every physics related part in your model.
I would do this:
local function giveModelToPlayer(model, owner)
local descendants = model:GetDescendants()
for index, descendant in pairs(descendants) do
if descendant:IsA("BasePart") then
descendant:SetNetworkOwner(owner)
end
end
end
-- Called when the character is added
local function onCharacterAdded(character)
local rootPart = character:WaitForChild("HumanoidRootPart")
-- Wait until rootPart is part of the workspace
while not rootPart:IsDescendantOf(workspace) do
wait()
end
-- Gives full control of the model to the player
local player = game.Players:GetPlayerFromCharacter(character)
giveModelToPlayer(character,player)
end
Tried the script you gave, problem still persists.
Would it be a possibility that the parts are simply falling asleep? Because sometimes I notice that the parts lose collision momentarily, and sometimes when I just the camera moves (insisting that the HumanoidRootPart moved) but the rest of the body just stays still.
Can’t diagnose the problem without any further information best I can do are the guesses. How did you set up the StarterCharacter in the first-place, is it even a StarterCharacter model?
How did you setup the rig? Is it motor6D and constraints or any other method?
Are you using a custom control script? I can see some print statements in output a normal humanoid controller won’t do that.
- I could give you the entire place file if you’d like!
- It’s a Model whose name is StarterCharacter. The HumanoidRootPart is welded to the LowerTorso of the ragdoll.
- No, I’m just using the one roblox generates for a startercharacter. The prints were just uis prints in a different script for the demonstration.
Hold on welds? Normally, we use Motor6Ds using a plugin like RigEdit to connect the root part to the rest of the body I wonder if that would change anything.
BTW, I’m not sure the scripts I gave work in the first place I would do a print debug to make sure who has network ownership over the model using a command line command by using :GetNetworkOwnership() on all the parts of the character to find out more information about if its a server ownership issue.
Hey, very sorry for the late response but I’m almost sure it’s a sleeping parts issue now. I did the motor6d and the problem stays the same.
Take a look at this video:
I’m able to move when the parts are awake, but as soon as the parts fall asleep I get stuck until they wake up from their snooze. So lazy! I don’t know how I’d go about fixing this either.