#Help!

1 messages · Page 1 of 1 (latest)

charred flame
#

I don't understand why the PartSizeMax cannot be 0.1. Are decimals not usable in this case? If so, why, and what other options are there? Any other tips for making this better are welcome as well!! I'm very very new to lua.

local PartSizeMax = 1
local PartSpreadMax = 50
local function ballAnim(part)
    local PartSizemodifier = math.random(0.1, PartSizeMax)
    for count = 1, 50 do
        part.Transparency = count / 50
        part.Size = Vector3.new((PartSizemodifier * count), (PartSizemodifier *  count), (PartSizemodifier *  count))
        task.wait(0.01)
    end
    part:Destroy()
end

while true do
    local MyPart = Instance.new("Part", workspace)
    MyPart.CanCollide = false
    MyPart.Shape = "Ball"
    MyPart.Anchored = true
    MyPart.Position = Vector3.new(math.random((PartSpreadMax * -1), PartSpreadMax), 0, math.random((PartSpreadMax * -1), PartSpreadMax))
    MyPart.BrickColor = BrickColor.new("Medium blue")
    MyPart.Material = "SmoothPlastic"
    
task.spawn(ballAnim, MyPart)
task.wait(0.1)
end```l
#

This is my first ever script btw lol

#

Just toying around trying to get used to variables.

weary copper
#

I dont see why it shouldnt work. But what you're trying to do here kind of confused me.

for count = 1, 50 do
        part.Transparency = count / 50
        part.Size = Vector3.new((PartSizemodifier * count), (PartSizemodifier *  count), (PartSizemodifier *  count))
        task.wait(0.01)
    end

Are you getting any errors? Decimals are usable in this case.

charred flame
weary copper
#

oh so you want the size of the ball to animate?

#

gotcha

#

if these are unanchored balls they arent going to do what you intend

#

the size is adjusted from the center of the ball

#

so it will just grow into the ground if its a ball on the ground

#

but what exactly is going on in your case?

charred flame
#
while true do
    local MyPart = Instance.new("Part", workspace)
    MyPart.CanCollide = false
    MyPart.Shape = "Ball"
    MyPart.Anchored = true```

They are anchored tho
charred flame
# weary copper but what exactly is going on in your case?

Well, as long as I have the PartSizeMax variable at 1, it works as intended. it looks like lots of bubbles getting bigger and fading, almost like popping, I guess. However, when I set that same variable to e.g 0.1, nothing spawns in at all.

#

And no, no error messages

weary copper
#

yeah nothing happens because of this line of code

local PartSizemodifier = math.random(0.1, PartSizeMax)
fresh patrolBOT
#

studio** You are now Level 9! **studio

weary copper
#

if you set it to 0.1

#

youre basically saying "get a random value between 0.1 and 0.1"

charred flame
#

OH

#

RIGHT

#

THANKS OMG

#

How'd I miss that

weary copper
#

np

charred flame
#

LOL

#

ouuuufhhh......

#

except that apparently didn't solve it

weary copper
#

whats up?

charred flame
#

I tried everything between 0.2 and 0.9, and none of them work

#

This is getting pretty complicated for such a small problem though, so I'll just rewrite it in another way :D

#

SOLVED!