Hi, I recently posted a question here on how to code a part to change size in 1 direction. I was given the answer to use the "resize" function. The problem I'm having is that I do not know how to use the function, the wiki didn't have any examples either.
This is my script:
local MDoor = script.Parent local handle = script.Parent.Parent.Handle game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(msg) if msg == "Open Door" then repeat MDoor.Size = MDoor.Size - Vector3.new(0, 1, 0) handle.Position = handle.Position - Vector3.new(0, 1, 0) wait(0.4) until MDoor.Size == Vector3.new(36, 1, 2) and handle.Position == Vector3.new(1406, 16, 644.5) end end) end)
I will greatly appreciate any form of help, Thanks!
I did give an example but I can put it in the script. I thought the wiki was pretty clear. Resize is a function of parts where you supply a face (enum) and an increment. It is exactly like studio tools. I also recommend a better evaluation at the end.
local MDoor = script.Parent local handle = script.Parent.Parent.Handle game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(msg) if msg == "Open Door" then repeat MDoor:Resize(Enum.NormalId.Top,-1) handle.Position = handle.Position - Vector3.new(0, 1, 0) wait(0.4) until MDoor.Size.y <= 1 and handle.Position.y <= 16 end end) end)
The wiki provides the following:
bool Resize ( NormalId normalId, int deltaAmount )
Basically, what this means, is that the normalId is what face you want to resize
Right = 0 Top = 1 Back = 2 Left = 3 Bottom = 4 Front = 5
and the deltaAmmount is by how much.
As stated in, NormalId is a side, DeltaAmount is how much to grow/shrink on that side. The part won't be resized if there is a part blocking the facial direction.
Considering I am unaware of which faces you want to resize, I'll make a "general" example.
local partToResize = workspace.ResizeMe for i = 1,10 do partToResize:Resize(Enum.NormalId.Top,i) partToResize:Resize(Enum.NormalId.Bottom,i) wait(1) end
The above code will resize the part on the Y axis evenly, 1 stud each direction every second. I do not recommend this method as it will not pass through parts, it just stops.