Hi!
Today I was making a script that makes your character model grow in size before shrinking back to its base size. My issue is with the position of the body parts after the size change occurs.
To prevent the joints from breaking I've cloned the player's character and all of it's children to a model that grows in size before taking the place of your character for several seconds before switching back. I've tested the model before making it grow in size and its body part are all perfectly positioned like a normal character model. But when the model's size has been tampered with, this happens: http://prntscr.com/cwa8c4. The player's body parts become compact, no animation occurs, and the model simply becomes a "levitating meat cube"
I've tried changing the position of the character's body parts with Vector3, but the changes don't stay, and if I attempt position the head, the player will die instantly, because the head weld will break.
Here's the function that sets the player's size:
function setSize (char, value) for _, child in pairs(char:GetChildren()) do if child:IsA("Hat") and child:FindFirstChild("Handle") then child = child.Handle elseif child:IsA("BasePart") then child.Size = child.Size + Vector3.new(value, value, value) end end end
And here's the code used to do all of the other work:
local enabled = true local click = Instance.new('ClickDetector') click.Parent = giantPart click.MouseClick:connect(function(hit) local char = hit.Character local player = game.Players:GetPlayerFromCharacter(char) local cenable = true if char and cenable then char.Archivable = true local m = char:Clone() if m then cenable = false local head = char:FindFirstChild("Head") local face = head:FindFirstChild("face") if enabled and head and game.Players:GetPlayerFromCharacter(char) and m then enabled = false setSize(m, 5) m.Parent = game.workspace player.Character = m if player.Character == m then game.workspace.Camera.CameraSubject = player.Character game.workspace.Camera.CameraType = "Custom" end wait(5) char.Parent = game.workspace char.Parent = player.Character player.Character = char char.Parent = game.workspace char:MoveTo(player.Character.Torso.Position) m:Destroy() if player.Character == char then game.workspace.Camera.CameraSubject = player.Character game.workspace.Camera.CameraType = "Custom" end wait(2) enabled = true cenable = true end end end end)
What I want to know is why this is happens, and hopefully how to fix it.
Please keep in mind that the player's character model has been replaced with a cloned model that's size has been changed to the value input.
Thanks!
You need to add place markers that are non-CanCollide and transparent to the arms and legs positions before you move them, then after the growing has finished, just set the various parts positions to the place markers positions. then destroy all the place markers and extra model. i would add it to your code is more complicated than what im used to. Good luck though :)