found character is able to jump but legs arent making player stand and roblox default client colliding bodyparts not woring
Okay, in that case, here is some code that should work.
local plrChar = plr.Character
local newChar = game.ServerStorage.Dummy:Clone() -- Change path to where you have your model.
local InstancesToClone = {"Animate", "Health"}
for _,v in pairs(InstancesToClone) do
if plrChar:FindFirstChild(v) and not newChar:FindFirstChild(v) then
plrChar[v]:Clone().Parent = newChar -- Clone the scripts that the character needs. You can modify the table to whitelist another instances.
end
end
newChar:PivotTo(plrChar:GetPivot()) -- Move the new character model to the old character.
for _, Inst in pairs(plrChar:GetChildren()) do
Inst:Destroy() -- Destroy ALL the current character parts.
end
for _, Inst in pairs(newChar:GetChildren()) do
Inst.Parent = plrChar -- Parent the new character parts into the player's character.
if Inst:IsA("BasePart") and Inst.Name == "HumanoidRootPart" then -- If It's the root part, set the network owner of the root part to the player.
Inst:SetNetworkOwner(plr)
plrChar.PrimaryPart = Inst
end
end
And also, since roblox does not update the controls of the PlayerModule
, you have to re-path the humanoid in the controls. For this you can add a LocalScript
inside the new character model with the next code:
local player = game.Players.LocalPlayer
local playerScripts = player:WaitForChild("PlayerScripts")
local Controls = require(playerScripts:WaitForChild("PlayerModule")):GetControls()
Controls.humanoid = script.Parent:WaitForChild("Humanoid")
game.Debris:AddItem(script, 1)
I tested this myself in studio and it works fine for me.
2 Likes
ok i will try it later thank you so much for helping me
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.