Hey, whenever I scale a custom character (this doesn’t happen with the default R15 character)—even just a simple 6x6x6 BasePart with a Humanoid—the movement lags noticeably as the character gets bigger. The lag only occurs while moving.
Here’s a video showing the issue:
The player has a region that checks nearby parts to eat, and when parts are detected, it scales the character.
Here is the scaling script:
function sizeChanger.scaleProp(player : Player, prop : Model)
if not prop then
prop = player.Character
end
local score = player:WaitForChild("playerData").score.Value
local scaleFactor = sizeChanger.getFinalScaleFactor(prop, score)
prop:ScaleTo(scaleFactor)
prop:FindFirstChild("Humanoid").WalkSpeed = walkSpeed
end
The player has NetworkOwnership of its characters ofc
local lastScaleForPlayer = {} -- keep track of last scale to avoid redundant scaling
function sizeChanger.scaleProp(player: Player, prop: Model?)
prop = prop or player.Character
if not prop then return end
local score = player:WaitForChild("playerData").score.Value
local newScale = sizeChanger.getFinalScaleFactor(score)
local humanoid = prop:FindFirstChildOfClass("Humanoid")
-- Prevent redundant scaling
if lastScaleForPlayer[player] == newScale then return end
lastScaleForPlayer[player] = newScale
-- Scale the character
prop:ScaleTo(newScale)
-- Adjust WalkSpeed proportionally (optional: clamp it if needed)
local baseSpeed = 16
local scaledSpeed = baseSpeed * newScale
humanoid.WalkSpeed = math.clamp(scaledSpeed, 8, 50)
-- Restore network ownership (just in case Roblox dropped it)
task.delay(0.1, function()
for _, part in ipairs(prop:GetDescendants()) do
if part:IsA("BasePart") then
part:SetNetworkOwner(player)
end
end
end)
end
Hi! I’m very sure that’s because your script on server. (ScaleTo updates CFrames of objects, and if you call it on server, because of delay between server and client (server always a bit “in past”) you’re being teleported back)
Yeah, that makes sence. but when i scale on the client. its only client sided chagne isnt it? other people wont be able to see the scaled version of my character,right?
also i was wrong, the lag also happens with normal R15 rig.
--Client
local Remote:RemoteEvent = game:GetService("ReplicatedStorage").Scale --Some event
Remote.OnClientEvent:Connect(function(Character, Scale)
if (Character ~= LocalCharacter) then
Character:ScaleTo(Scale)
end
end)
These scripts above are just examples, it doesn’t check character existence, doesn’t ensure that event was sent not by exploiters.
scalePropEvent.OnClientEvent:Connect(function(player : Player, prop : Model)
local score = player.playerData.score.Value
local scaleFactor = sizeChanger.getFinalScaleFactor(prop, score)
prop:ScaleTo(scaleFactor)
if game.Players.LocalPlayer == player then
local hum = prop:FindFirstChildOfClass("Humanoid")
if not hum then
warn("[scalePropEvent] Couldnt find Humanoid")
end
hum.WalkSpeed = walkSpeed
hum.JumpPower = jumpPower
end
end)
just, is this enought for security?
I have a playerData with players score inside and via that i get the scale factor
Uhh sorry for late reply.
Exploiter can fire remote event from his script, and can insert any data inside, including score.
And if server doesn’t ensure event’s data was sent by your script but not exploiter’s,
he can just type like this: Event:FireServer(99999999) and get this score.
If you need, i’ll write down algorithm for security.
You probably misunderstand me with character check, but i don’t see the point
in this if statement: if game.Players.LocalPlayer == player then