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

How would I make it so that as the Ice increases the size it will do damage while it does?

Here's my script;

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local characterLL = plr.CharacterAdded:Wait():WaitForChild('Left Leg')
local Clicked = true

mouse.KeyDown:Connect(function(K)
	if K == 'z' and Clicked == true then
		local NewIce = Instance.new("Part")
		local NewValue = Instance.new('StringValue')
		NewValue.Name = 'Owner'
		NewValue.Parent = NewIce
		NewValue.Value = plr.Name
		NewIce.Size = Vector3.new(5,0.2,5)
		wait(0.1)
		NewIce.Size = Vector3.new(5.5,0.2,5.5)
		wait(0.1)
		NewIce.Size = Vector3.new(6,0.2,6)
		wait(0.1)
		NewIce.Size = Vector3.new(6.5,0.2,6.5)
		wait(0.1)
		NewIce.Size = Vector3.new(7,0.2,7)
		wait(0.1)
		NewIce.Size = Vector3.new(7.5,0.2,7.5)
		wait(0.1)
		NewIce.Size = Vector3.new(8,0.2,8)
		wait(0.1)	
		NewIce.Size = Vector3.new(8.5,0.2,8.5)
		wait(0.1)
		NewIce.Size = Vector3.new(9,0.2,9)
		wait(0.1)
		NewIce.Size = Vector3.new(9.5,0.2,9.5)
		wait(0.1)
		NewIce.Size = Vector3.new(10,0.2,10)
		NewIce.Name = 'Ice'
		NewIce.Anchored = true
		NewIce.CanCollide = true
		NewIce.Material = 'Ice'
		NewIce.BrickColor = BrickColor.new('Pastel light blue')
		NewIce.TopSurface = 'Smooth'
		NewIce.BottomSurface = 'Smooth'
		NewIce.Parent = game.Workspace
		NewIce.Position = characterLL.Position
		Clicked = false
		NewIce.Touched:Connect(function(h)
			if h.Parent.Name == NewValue.Value then
				Clicked = false
			else if h.Parent:FindFirstChild("NPC").Value == true then
				local Humanoid = h.Parent:WaitForChild("Humanoid")
				Humanoid.WalkSpeed = 0
				Humanoid.Health = Humanoid.Health - 20
				wait(3)
				Humanoid.WalkSpeed = 10
				else if h.Parent:FindFirstChild("NPC").Value == false then
					local Humanoid = h.Parent:WaitForChild("Character").Humanoid
					Humanoid.WalkSpeed = 0
					Humanoid.Health = Humanoid.Health - 20
					wait(3)
					Humanoid.WalkSpeed = 16
				end
			end
		print("complete")
		wait(2.5)
		Clicked = true
		NewIce:Destroy()
		end
		end)
	end
end)

I'm trying to make the ice slowly become bigger and it will damage at the same time.

The problem is the ice takes too long to load in and it waits until the ice finishes loading but I want it to do damage even if it's still extending. I need it to do damage even if it is still extending.

1 answer

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