Basically there is a variable under "Bricksize" and when your holding v it increases +.2 But What I want is when the value is more than 22 The script fires. Any help?

Player = script.Parent.Parent
char =Player.Character
mouse = Player:GetMouse()
RS = char.Torso["Right Shoulder"]
LS = char.Torso["Left Shoulder"]
local hold = true
animation = script:WaitForChild("Animation")
k = true

function OnKeyDown(key)
	key:lower()
	if key == "v" then
		hold = true
		BrickSize()
	end
end

function BrickSize()
	size = 16
	dmg = 30
	
	while hold == true  do
		wait()
		size = size+.02
		dmg = dmg+5
		print("counted tp:"..size..".")
		print("and did "..dmg.."dmg")

end
end		
		
function OnKeyUp(key)
	key:lower()
	if key == "v" then
		local animationTrack = Player.Character.Humanoid:LoadAnimation(animation)	
			x = Instance.new("Part")
		animationTrack:Play()
					wait(.35)
x.BrickColor = BrickColor.new("Deep orange")
x.Transparency = 0
x.Material = "Neon"
x.TopSurface = "Smooth"
x.BottomSurface = "Smooth"
x.Name = "ball1"
x.Shape = "Ball"
x.CanCollide = false
x.Size = Vector3.new(size,size,size)
y = Instance.new("BodyVelocity")
y.maxForce = Vector3.new(math.huge,math.huge,math.huge)
y.velocity = Player.Character.Torso.CFrame.lookVector*80
x.Parent = workspace
y.Parent = x
x.CFrame = Player.Character.Torso.CFrame*CFrame.new(0,0,-12)
hold = false
game.Debris:AddItem(x,4)
game.workspace:WaitForChild("ball2"):Remove()	
wait(2)

--
function  onDamage(Part)
	if Part.Parent:FindFirstChild("Humanoid")~= nil then
		Part.Parent.Humanoid.Health = Part.Parent.Humanoid.Health-dmg
		x:Remove()
		print("Hit")
	end
end

x.Touched:connect(onDamage)
		hold = false	

		end
end

mouse.KeyDown:connect(OnKeyDown)
mouse.KeyUp:connect(OnKeyUp)




2 comments

0

You could try if value >= 22 then

0

Yeah but what do I put after then