Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Snowball spell not summoning a snowball when used once, as well of the snowball falling (?)

Asked by 1 year ago

I am making a tool that summons a snowball that moves In a straight line, which grows every 0.1 second (In roblox time) anyway It somewhat works, when I use the tool once It works just the snowball falls down, but when I used It again It won't let me summon a snowball

Script:

local tool = script.Parent
local Debounce = false

tool.Activated:Connect(function()
    if Debounce == false then
        Debounce = true
        tool.Explosion:Play()
        print("Snowball use uh turn people Into snowman or whatever, yeah")
        local SnowBall = Instance.new("Part")
        local VectorForce = Instance.new("VectorForce")
        local Attachment = Instance.new("Attachment")
        local ParticleEffect = Instance.new("ParticleEmitter")
        SnowBall.Parent = game.Workspace
        SnowBall.Position = tool.Parent.Torso.Position
        SnowBall.Orientation = tool.Parent.Torso.Orientation
        SnowBall.Shape = Enum.PartType.Ball
        SnowBall.Size = Vector3.new(1.553, 1.553, 1.553)
        SnowBall.CanCollide = false
        SnowBall.Material = Enum.Material.Sand
        SnowBall.BrickColor = BrickColor.White()
        VectorForce.Parent = SnowBall
        Attachment.Parent = SnowBall
        VectorForce.Attachment0 = Attachment
        VectorForce.Force = Vector3.new(0,600,-3000)
        ParticleEffect.Parent = SnowBall
        ParticleEffect.Texture = "http://www.roblox.com/asset/?id=9497095000"
        ParticleEffect.Transparency = NumberSequence.new(0.5)
        ParticleEffect.Lifetime = NumberRange.new(1,1)
        ParticleEffect.Rate = 10
        ParticleEffect.Rotation = NumberRange.new(-90,90)
        ParticleEffect.RotSpeed = NumberRange.new(-75,75)
        ParticleEffect:Emit(10)
        while wait(0.1) do
            SnowBall.Size = SnowBall.Size+Vector3.new(1,0,0)
        end
        game:GetService("Debris"):AddItem(SnowBall,3)
        wait(3)
        Debounce = false
    end
end)

1 answer

Log in to vote
1
Answered by 1 year ago

Hello!,

On line 33, you have entered a while loop, but it wont get out of the while loop until loop is broken, try something like

local tool = script.Parent
local Debounce = false

tool.Activated:Connect(function()
    if Debounce == false then
        Debounce = true
        tool.Explosion:Play()
        print("Snowball use uh turn people Into snowman or whatever, yeah")
        local SnowBall = Instance.new("Part")
        local VectorForce = Instance.new("VectorForce")
        local Attachment = Instance.new("Attachment")
        local ParticleEffect = Instance.new("ParticleEmitter")
        SnowBall.Parent = game.Workspace
        SnowBall.Position = tool.Parent.Torso.Position
        SnowBall.Orientation = tool.Parent.Torso.Orientation
        SnowBall.Shape = Enum.PartType.Ball
        SnowBall.Size = Vector3.new(1.553, 1.553, 1.553)
        SnowBall.CanCollide = false
        SnowBall.Material = Enum.Material.Sand
        SnowBall.BrickColor = BrickColor.White()
        VectorForce.Parent = SnowBall
        Attachment.Parent = SnowBall
        VectorForce.Attachment0 = Attachment
        VectorForce.Force = Vector3.new(0,600,-3000)
        ParticleEffect.Parent = SnowBall
        ParticleEffect.Texture = "http://www.roblox.com/asset/?id=9497095000"
        ParticleEffect.Transparency = NumberSequence.new(0.5)
        ParticleEffect.Lifetime = NumberRange.new(1,1)
        ParticleEffect.Rate = 10
        ParticleEffect.Rotation = NumberRange.new(-90,90)
        ParticleEffect.RotSpeed = NumberRange.new(-75,75)
        ParticleEffect:Emit(10)
    Debounce = false
    game:GetService("Debris"):AddItem(SnowBall,3)
        while SnowBall and wait(0.1) do
            SnowBall.Size = SnowBall.Size + Vector3.new(1,0,0)
        end
    end
end)
0
Hello! Thank you! It works but the snowball will keep falling even I want It to be floating moving In a straight line but I'll accept It! imnotaguest1121 362 — 1y
Ad

Answer this question