cazboy10Join Date: 2011-07-28 Post Count: 25 |
I can't seem to figure out how to change the size of a model through a script. Any help would be great. |
|
|
OzzzeyJoin Date: 2015-07-15 Post Count: 349 |
Why would you ask for pay? He just wants some help. I will do it for free :)
So, you have to make a function. ex) function(Touched()
then, you will have to make it so that the script finds the brick/part.
ex) script.Parent.Brick.workspace
then, you will have to make a connecting function.
ex) script.Parent.Parent.Touched.connect:(Touched)
finally, you will have to make it so that the size is smaller/bigger.
I hope this was helpful!
That one dank dude ecks dee |
|
IceladenJoin Date: 2009-02-08 Post Count: 6177 |
what does a touched event have to do with anything
|
|
|
cazboy10Join Date: 2011-07-28 Post Count: 25 |
So, I already know how to change a part size with a script, if that's what you're explaining. The problem I'm running into is changing the size of an entire Model, with a script. |
|
yin_yangJoin Date: 2016-02-24 Post Count: 537 |
> "finally, you will have to make it so that the size is smaller/bigger."
lol
|
|
|
local increase = 2 -- 1 will do nothing
for i,v in pairs(Model:GetChildren()) do
if v:IsA('Part') then
v.Size = Vector3.new(v.Size * increase)
end
end
This siggy is classified | R$1,672 |
|
|
Yo, smurf guy. Scripting doesn't mean what it actually means.
The script says some stuff
The stuff happens
It sounds creepy like "children" but it doesn't mean that at all.
At least, that's how I understand it. |
|
|
Children is an object inside an object
xd
.Touched is an event
script.Parent.Touched:connect(function(Hit)
end)
This siggy is classified | R$1,672 |
|
SpathiJoin Date: 2013-11-18 Post Count: 14776 |
This thread is so bad
Talented builder, and scripter |
|
cazboy10Join Date: 2011-07-28 Post Count: 25 |
I have:
wait(5)
local increase = 2
for i,v in pairs(game.Workspace.Test:GetChildren()) do
if v:IsA('Part') then
v.Size = Vector3.new(v.Size * increase)
end
end
But, it just makes every part in the model extremely small. I've tried changing how much it increases, but still does this. |
|
VxrtualJoin Date: 2015-04-18 Post Count: 26 |
Maybe try doing this:
Ungroup your model, and instead make it a union. (Might have some side effects, I've never tried) Put this script in your union.
function (whatever you want) ()
for i = 1(or another number), 0.1, 0.01 do
script.Parent.Size = Vector3.new (i, i, i)
end
end
script.Parent.(event that activates the function such as .Touched):connect(Function Name)
This might work, but I've never tried it. |
|
VxrtualJoin Date: 2015-04-18 Post Count: 26 |
Sorry but made a small error you need to add something to this line:
script.Parent.Size = Vector3.new(i, i, i)
You need to make it like this instead:
script.Parent.Size = Vector3.new(i, i, i)
wait(0.01)
This will make it so it doesn't grow instantly |
|
QuasiduckJoin Date: 2008-09-28 Post Count: 2437 |
Why not just use an already existing model resize script?
Or do you want to figure it out for yourself? |
|
VxrtualJoin Date: 2015-04-18 Post Count: 26 |
if you want it to change instantly, then use the first way I mentioned. If not then change that part to the updated one. |
|
QuasiduckJoin Date: 2008-09-28 Post Count: 2437 |
origin = script.Parent.PrimaryPart.Position
Scale = 0.1
for _,v in pairs (script.Parent:GetChildren()) do
if v:IsA("BasePart") then
saveVec = v.Position - origin
saveCf = v.CFrame
v.Size = v.Size*Scale
v.CFrame = saveCf - saveCf .p + origin + saveVec*Scale
end
end |
|