I am making a stomp attack for one of the bosses in my game. I want a circle that expands from the boss that the player has to jump over. I have a circle but when i try and resize it in any way with the script, it just turns out very unproportional.
local Circle = script.Parent.Parent
for i, v in pairs(Circle:GetChildren()) do
if v:isA("Part") then
coroutine.wrap(function()
for i = 0, 1, .2 do
v.Size = v.Size + Vector3.new(i, 0, i)
wait(.5)
end
end)()
end
end
This is because you are only updating the size. You need to update the size and the position.
You can think of your circle as a collection of points where the parts intersect. If you were to double the size, you would need to simply double the distance between those points and the center. Then resize the parts along one axis to touch both ends again.
I would write out some code to show, but I’m on mobile so that would be take a long time and probably error filled.
I think I know what you want to accomplish as I ran into this issue, or something similar to it, a few months ago. I didn’t find a way to make the circle look equally “good” as it grows bigger, but I made a mesh in Blender and made the size bigger using TweenService.
Here is my result:
Edit: I think doing it with one mesh would be better than multiple parts, but idk if it is even possible with one mesh. Also, I couldn’t really find an example on YouTube or Google of the expanding ring thing.
Simply provide thr size property inside the table in the tween and set a size goal. Short example:
--Get TweenService and set TweenInfo
local MeshPart = "YourPart"
local goals = {Size = Vector3.new(5,5,5)}
local Tween = TweenService:Create(MeshPart, Info,goals)
Tween:Play()
local MeshPart = script.Parent.Union
local goals = {Size = Vector3.new(5,5,5)}
local tweenInfo = TweenInfo.new(5)
local Tween = game:GetService("TweenService"):Create(MeshPart, tweenInfo,goals)
Tween:Play()
The goal of a tween is the end. So when a tween is done playing the size will be equal to 5,5,5. (based on the code further above.) This is smaller than 20.857,1.006, 20.856 so that is why it looks like it is getting smaller.
Try making the goal bigger, something like 40,2,40.
I would suggest you save the standard size, so we can multiply the size
local TweenService = game:GetService("TweenService")
local MeshPart = script.Parent:WaitForChild("Union")
local MultipliedSize = 3
local SavedSize = MeshPart.Size
local Tween = TweenService:Create(MeshPart,TweenInfo.new(5),{Size = Vector3.new(SavedSize.X*MultipliedSize,SavedSize.Y,SavedSize.Z*MultipliedSize)})
Tween:Play()
This works, but when I dont change the Y axis, nothing moves. But if I do change the y axis, it will become impossible to jump over, because the map is kinda big.
But if your ring starts really small, then the multiplied size would need to be in the 100’s or 1000’s - But it does not effect performance at all that we multiply it by that much, it’s simple math.
Sorry it was awhile, when i use that scipt would work, but it is a union so when I try to change only the x and z axis, it wont move, it will only size if I change the Y axis too. How would I do this with multiple parts?
You cannot change size of a union the same way you can with a part or meshpart, a union acts like a model will, if you tried to scale it. Go make a ring in blender and import it to studio as a meshpart.