Help with Sizing

Hi, I’m making an ice move, even tho this is like the 2nd thread, I’ve decided to post again since it’s a little itty bit different.

Script
return function(plr)
	local tweenservice = game:GetService("TweenService")
	local tweeninfo = TweenInfo.new(0.35, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut)
	local mouse = plr:GetMouse()
	local mouseCF = mouse.Hit
	local mousePos = Vector3.new(mouseCF.Position.X,plr.Character.HumanoidRootPart.Position.Y,mouseCF.Position.Z)
	local start = plr.Character.HumanoidRootPart.CFrame
	-- local goal = start.LookVector * 70
	local spikesNum = math.random(4, 4)
	local shardIncrements = 70 / spikesNum
	for i = 1, spikesNum do
		local newSpike = script.IceSpike:Clone()
		local newplat = script.Platform:Clone()
		newplat.Anchored = true
		newplat.CanCollide = false
		newSpike.Anchored = true
		newSpike.CanCollide = true
		local x, y, z = 20 * i, 1, 10 * i
		newSpike.Size = Vector3.new(0, 0, 0)
		newplat.Size = Vector3.new(0, 0, 0)
		local pos = plr.Character.HumanoidRootPart.Position + start.LookVector * (shardIncrements * i)
		local ori = plr.Character.HumanoidRootPart.Orientation
		newSpike.Position = Vector3.new(pos.X, pos.Y + 5.25, pos.Z)
		newplat.Position = Vector3.new(pos.X, pos.Y - 2.5, pos.Z)
		newSpike.Orientation = plr.Character.HumanoidRootPart.Orientation + Vector3.new(0, 270, 0)
		newplat.Orientation = plr.Character.HumanoidRootPart.Orientation + Vector3.new(0, 270, 0)
		local newsizeplat = Vector3.new(20 * i, 4, 20 * i)
		local newposplat =  newplat.Position 
		local newPos = newSpike.Position
		local newSize = Vector3.new(19 * i, 15 * i,  17 * i)
		local tween = tweenservice:Create(newSpike, tweeninfo, {Size = newSize, Position = newPos})
		local plattween = tweenservice:Create(newplat, tweeninfo, {Size = newsizeplat, Position = newposplat})
		newplat.Parent = workspace.Effects
		newSpike.Parent = workspace.Effects
		tween:Play()
		plattween:Play()

		
		 local parts = workspace:GetPartsInPart(newSpike)
		
		--[[ if parts:IsA("BasePart") then
			if parts.Parent:IsA("Model") then
				if parts.Parent["Humanoid"] then
					local hum = parts.Parent:WaitForChild("Humanoid")
					hum:TakeDamage(30)
				end
			end
		end  --]]
		
		coroutine.resume(coroutine.create(function()
			wait(3)
			local reverseTween = tweenservice:Create(newSpike, tweeninfo, {Size = Vector3.new(0, 0, 0), Position = Vector3.new(pos.X, 0, pos.Z)})
			local reverseTween2 = tweenservice:Create(newplat, tweeninfo, {Size = Vector3.new(0, 0, 0), Position = Vector3.new(pos.X, 0, pos.Z)})
			reverseTween:Play()
			wait(0.35)
			reverseTween2:Play()
			reverseTween.Completed:Wait()
			newSpike:Destroy()
			reverseTween2.Completed:Wait()
		end))
		wait(math.random(1, 100)/1000)
	end
	plr.Busy.Value = false
	print("z move done!")
end

The one I’m stuck on is: local newSize = Vector3.new(19 * i, 15 * i, 17 * i)
I want it so it increases the Y axis on top, not below.


The arrows indicate where it’s increasing, it increases depending on which spike, for example 1 is the normal sized one, 2 is fairly higher, and so on. I’d love some help, thank you.

1 Like

Maybe move it up (position) as you increase the size.

The positioning part is kinda complicating for me and is out of my knowledge, I only completed the positioning because someone helped me in another thread but he’s probably asleep and busy.

When you change the size, it will increase evenly on both the top and bottom side. So usually, you would add half of the value you’re adding to the size to the position.

local newSize = Vector3.new(19 * i, 15 * i, 17 * i)

In this case, a typical solution would be to add + Vector3.new(0, (15/2) * i, 0) to the new position. But this may vary depending on your desired effect.

https://gyazo.com/20f0a8dcdd39b70bc1a2169d9480ae2b It still happens.

Edit, Oh wait, u meant position I’ll try that out and ill let u know

That does align the spikes https://gyazo.com/ec85afd3142018475cf49d1b0e84d9b3
ALTHOUGH, they’re not in the same position as the ice circles and it’s like floating.
If I decrease it to 12/2, it goes up to down again https://gyazo.com/79923eb73c72c15d4893cdea28b96040

Try changing it to:

+ Vector3.new(0, (15/2) * i - 15, 0)

You can test different values for the second 15, but keep the (15/2) as it is.

1 Like

I made some changes to the script and did what you told me to do, but not the (15/2) * i - 15 thingy, I did the (15/2) * i one only.
Here’s the script:

return function(plr)
	local tweenservice = game:GetService("TweenService")
	local tweeninfo = TweenInfo.new(0.35, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut)
	local mouse = plr:GetMouse()
	local mouseCF = mouse.Hit
	local mousePos = Vector3.new(mouseCF.Position.X,plr.Character.HumanoidRootPart.Position.Y,mouseCF.Position.Z)
	local start = plr.Character.HumanoidRootPart.CFrame
	-- local goal = start.LookVector * 70
	local spikesNum = math.random(4, 4)
	local shardIncrements = 70 / spikesNum
	for i = 1, spikesNum do
		local newSpike = script.IceSpike:Clone()
		local newplat = script.Platform:Clone()
		newplat.Anchored = true
		newplat.CanCollide = false
		newSpike.Anchored = true
		newSpike.CanCollide = true
		local x, y, z = 10 * i, 1, 10 * i
		newSpike.Size = Vector3.new(0, 0, 0)
		newplat.Size = Vector3.new(0, 0, 0)
		local pos = plr.Character.HumanoidRootPart.Position + start.LookVector * (shardIncrements * i)
		local ori = plr.Character.HumanoidRootPart.Orientation
		newSpike.Position = Vector3.new(pos.X, pos.Y - 3, pos.Z)
		newplat.Position = Vector3.new(pos.X, pos.Y - 2.5, pos.Z)
		newSpike.Orientation = plr.Character.HumanoidRootPart.Orientation + Vector3.new(0, 270, 0)
		newplat.Orientation = plr.Character.HumanoidRootPart.Orientation + Vector3.new(0, 270, 0)
		local newsizeplat = Vector3.new(x, 2.5, z)
		local newposplat =  newplat.Position
		local newPos = newSpike.Position + Vector3.new(0, (6/2) * i, 0)
		local newSize = Vector3.new(x, 6 * i,  z)
		local tween = tweenservice:Create(newSpike, tweeninfo, {Size = newSize, Position = newPos})
		local plattween = tweenservice:Create(newplat, tweeninfo, {Size = newsizeplat, Position = newposplat})
		newplat.Parent = workspace.Effects
		newSpike.Parent = workspace.Effects
		tween:Play()
		plattween:Play()

		
		 local parts = workspace:GetPartsInPart(newSpike)
		
		--[[ if parts:IsA("BasePart") then
			if parts.Parent:IsA("Model") then
				if parts.Parent["Humanoid"] then
					local hum = parts.Parent:WaitForChild("Humanoid")
					hum:TakeDamage(30)
				end
			end
		end  --]]
		
		coroutine.resume(coroutine.create(function()
			wait(3)
			local reverseTween = tweenservice:Create(newSpike, tweeninfo, {Size = Vector3.new(0, 0, 0), Position = Vector3.new(pos.X, 0, pos.Z)})
			local reverseTween2 = tweenservice:Create(newplat, tweeninfo, {Size = Vector3.new(0, 0, 0), Position = Vector3.new(pos.X, 0, pos.Z)})
			reverseTween:Play()
			wait(0.35)
			reverseTween2:Play()
			reverseTween.Completed:Wait()
			newSpike:Destroy()
			reverseTween2.Completed:Wait()
			newplat:Destroy()
		end))
		wait(math.random(1, 100)/1000)
	end
	plr.Busy.Value = false
	print("z move done!")
end

Although, I’ve been trying to fix this but there’s a little itty bit of space,