generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Making the character smaller

Previous Thread :: Next Thread 
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
27 Sep 2014 06:31 PM
How do I make the character smaller, like 1.3, 0.7 etc.?


What I currently have ( Not working and from clonetrooper):


function scaleCharacter(model,scale)
if not model or not scale then return end
if not _G.ScaleCons then
_G.ScaleCons = {}
end
if _G.ScaleCons[model] then
_G.ScaleCons[model]:disconnect()
end
local joints = {}
local parts = {}
local h = model:findFirstChild("Humanoid")
if h then
h.Parent = nil
end
local function handleHat(hat)
if hat:findFirstChild("GotScaled") then return end
Instance.new("Flag",hat).Name = "GotScaled"
Spawn(function ()
local h = hat:WaitForChild("Handle")
local m = h:WaitForChild("Mesh")
m.Scale = m.Scale * scale
end)
local yInc = (scale-1)*.5
hat.AttachmentPos = (hat.AttachmentPos * scale) - (hat.AttachmentUp * Vector3.new(yInc,yInc,yInc))
end
for _,v in pairs(model:GetChildren()) do
if v:IsA("BasePart") then
table.insert(parts,v)
v.Anchored = true;
v.FormFactor = "Custom";
for _,j in pairs(v:GetChildren()) do
if j:IsA("Motor6D") then
local t = {
Name = j.Name;
Parent = v;
Part0 = j.Part0;
Part1 = j.Part1;
C0 = j.C0;
C1 = j.C1;
}
table.insert(joints,t)
j:Destroy()
end
end
elseif v:IsA("Hat") then
handleHat(v)
end
end
for _,v in pairs(parts) do
v.Size = v.Size * scale
v.Anchored = false
end
for _,j in pairs(joints) do
local c0 = {j.C0:components()}
local c1 = {j.C1:components()}
for i = 1,3 do
c0[i] = c0[i] * scale
c1[i] = c1[i] * scale
end
j.C0 = CFrame.new(unpack(c0))
j.C1 = CFrame.new(unpack(c1))
local n = Instance.new("Motor6D")
for k,v in pairs(j) do
n[k] = v
end
end
model.ChildAdded:connect(function (c)
if c:IsA("Hat") then
handleHat(c)
end
end)
if h then
h.Parent = model
end
_G.ScaleCons[model] = con
end
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image