Hi, I am making a game, and I am trying to make a players character when they press “F” scale smaller/larger. But when I press “F” the size of the parts in the character get smaller but they are away from eachother. And I dont know where to start to fix this problem.
1 Like
Your script is only change the size of the parts, and not accounting for there position. You’d have to rescale the position of the parts as well. This should help!
This works, but for some reason you have to keep switching Humanoid.AutomaticScalingEnabled
before and after a change in size to make it apply to the Humanoid.
local Humanoid = script.Parent:WaitForChild("Humanoid",3);
local HS = Humanoid.HeadScale;
local BDS = Humanoid.BodyDepthScale;
local BWS = Humanoid.BodyWidthScale;
local BHS = Humanoid.BodyHeightScale;
spawn(function()
for i=0, 30 do
Humanoid.AutomaticScalingEnabled = false;
HS.Value += 0.1;
BDS.Value += 0.1;
BWS.Value += 0.1;
BHS.Value += 0.1;
Humanoid.AutomaticScalingEnabled = true;
wait();
end
end)
1 Like
--LOCAL
local Enumeration = Enum
local Game = game
local UserInputService = Game:GetService("UserInputService")
local ReplicatedStorage = Game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:FindFirstChild("RemoteEvent") or ReplicatedStorage:WaitForChild("RemoteEvent")
local Keys = {Q = true, E = true}
local function OnInputBegan(InputObject, GameProcessed)
if GameProcessed then return end
if not (Keys[InputObject.KeyCode.Name]) then return end
RemoteEvent:FireServer(InputObject.KeyCode.Name)
end
UserInputService.InputBegan:Connect(OnInputBegan)
--SERVER
local Game = game
local ReplicatedStorage = Game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage.RemoteEvent
local Scales = {"BodyTypeScale", "DepthScale", "HeadScale", "HeightScale", "ProportionScale", "WidthScale"}
local function OnRemoteTriggered(Player, Key)
local Character = Player.Character
if not Character then return end
local Humanoid = Character:FindFirstChildOfClass("Humanoid")
if (not Humanoid) or Humanoid.Health <= 0 then return end
local Description = Humanoid:GetAppliedDescription()
for _, Scale in ipairs(Scales) do
Description[Scale] = if Key == "Q" then 0.5 elseif Key == "E" then 2 else Description[Scale]
end
Humanoid:ApplyDescription(Description)
end
RemoteEvent.OnServerEvent:Connect(OnRemoteTriggered)
This solution requires a single ‘RemoteEvent’ object placed inside the ‘ReplicatedStorage’ container. ‘Q’ halves the player’s character’s size and ‘E’ doubles the player’s character’s size.
2 Likes