Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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)

1 comment

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!

This discussion is preserved as it was. New answers, comments, and votes are closed.