Basically I have some code that when you press F it creates a sphere that gets bigger until it is destroyed:

function Ability()
	if player.Character then
		local Character = player.Character
			local p = Instance.new("Part",game.Workspace)
			game.Debris:AddItem(p,10)
			p.Anchored = true
			p.Shape = "Ball"
			p.CanCollide = false
			p.FormFactor = Enum.FormFactor.Custom
			p.Size = Vector3.new(0.5,0.5,0.5)
			p.BrickColor = BrickColor.Random()
			p.Material = Enum.Material.Foil
			p.Touched:connect(Blow) -- knock back here
			for i = 1,20 do
			wait(0.02)
				p.BrickColor = BrickColor.Random()
				p.Size = Vector3.new(p.Size.X + 1.75,p.Size.Y + 1.75,p.Size.Z + 1.75)
				p.Rotation = Vector3.new(math.random(1,360),math.random(1,360),math.random(1,360))
				p.CFrame = player.Character.Torso.CFrame
				p.Transparency = p.Transparency + 0.05
				
			end
		p:Destroy()
	end
end

and here is the start up code for the marked bit above ^

function Blow(hit)
	if hit.Parent ~= nil and hit.Parent ~= vPlayer.Character then
			local humanoidPlyr = game.Players:GetPlayerFromCharacter(hit.Parent)
					
			if humanoidPlyr then
				if hit.Parent.Humanoid.Health > 0 then
					if humanoidPlyr.PlayerData.PvP.Value == true then
						-- What do I add here? ( for example add a body velocity thing or something?)					end
			end
		end
	end
end

So when the sphere is touched by another humanoid, they are thrown back in the opposite direction of the player, how would I code this? Any Help much appreciated, Thx ~Bubs

1 comment

0

You're not even trying.