I have a wrecking ball that im testing out, and to make it work better I want to multiply the velocity with the size, (faster the wrecking ball goes, the more damage it does)
yt link to what i want it to look like:
as you can see in the video, the red part changes in size (which is what i want to make bigger depending on the velocity) the reason i need the red part, is because its the reason how the parts are actually breaking, the actual wrecking ball just pushes it over.
my current code for the sizing:
local value = script.Parent.VelocityValue --value that stores the velocity
local ball = script.Parent.Destroypart --the red part
while true do
task.wait()
value.Value = script.Parent.AssemblyLinearVelocity
--print(value.Value) --this is just for testing
ball.Size = ball.Size + ball.Size * Vector3.new(value.Value) --the line thats not working
print(ball.Size) --this is also for testing
end
What is the actual problem?
Is your sizing of the Red Area not working?
Is the damage not happening as strong as you want?
Not sure I get what the problem is, considering in the video the Red Area changes size with your velocity, and you seem to be doing damage to the blocks within that Red Area.
???
I meant if you set a limit, so the size of the red area didn’t just go out of control
But really if thats not an issue, you don’t need a limit, just a ratio of how many studs larger for how much velocity change.
Such as if you wanted it to get .5 studs bigger every 1 velocity increase, you would just do
redSize = smallestRedSize + (currentVelocity * .5)
local ball = script.Parent.Destroypart
local maxvelocity = Vector3.new(11,-25,47)
local maxsize = Vector3.new(12.5,12.5,12.5)
local minsize = Vector3.new(7.429, 7.429, 7.429)
while true do
task.wait()
local currentvelocity = script.Parent.AssemblyLinearVelocity
value.Value = currentvelocity
print(currentvelocity)
local velocityRatio = (maxvelocity - currentvelocity) / maxvelocity
ball.Size = minsize + ( (maxsize- minsize)*maxvelocity)
--ball.Size = ball.Size + ball.Size * Vector3.new(value.Value)
print(ball.Size)
end
but it doesn’t work, it just makes the red part huge, to the part where u cant see it but u can see the shadow. and the size never changes, it just sets to 63.21000289916992, 0.0010000000474974513, 245.76600646972656
local ballPart = script.Parent.BallPart
local redBall = script.Parent.Destroypart
local maxvelocity = 50--Vector3.new(11,-25,47)
local minsize = redBall.Size.X -- Vector3.new(7.429, 7.429, 7.429)
local maxsize = 12.5
local multiplier = (maxsize - minsize) / maxvelocity
while true do
local currentvelocity = ballPart.AssemblyLinearVelocity.Magnitude
local size = math.min( (currentvelocity*multiplier)+minsize, maxsize )
redBall.Size = Vector3.new(size,size,size)
task.wait()
end