Hey, im working on game where when a player touches a part they get bigger using custom characters. But we have run into a issue where when we update the scale of the character we get a weird jitter have no idea how to fix it
local module = {}
function module.Calculate(Player : Player)
if Player then
local Character = Player.Character
if not Character then return false end
local Humanoid = Character:FindFirstChildOfClass("Humanoid")
local HRP = Character:FindFirstChild("HumanoidRootPart")
local Torso = Character:FindFirstChild("Torso")
if not Humanoid or not HRP or not Torso then return false end
local MeshSize = HRP:FindFirstChildOfClass("SpecialMesh")
local success, errorMsg = pcall(function()
if MeshSize then
local CharacterScale : number = Character:GetScale()
print(CharacterScale)
Character:ScaleTo(Character:GetScale() + 0.01)
local scale = Character:GetScale() * 2
Humanoid:WaitForChild("BodyDepthScale").Value = scale
Humanoid:WaitForChild("BodyHeightScale").Value = scale
Humanoid:WaitForChild("BodyWidthScale").Value = scale
Humanoid.HipHeight = Character:GetScale()
Player:WaitForChild("Data").Size.Value += 1
Humanoid.WalkSpeed = 12
Humanoid.JumpPower = 0
end
end)
if not success then
warn("Error during scaling tween: " .. errorMsg)
return false
end
return true
end
return false
end
return module