Self explanatory. Sometimes it just doesn’t apply the velocity.
Code: (Server Script)
script.GetPos:FireClient(plr)
local bvelo = Instance.new("BodyVelocity")
bvelo.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bvelo.Parent = ball
game.Debris:AddItem(bvelo, 0.05)
script.GetPos.OnServerEvent:Connect(function(plr2, stuff, mousepos)
local directionVector = (mousepos - ball.Position).Unit
bvelo.Velocity = (directionVector * 100)
end)
ball.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChildWhichIsA("Humanoid")
local team = hit.Parent:FindFirstChildWhichIsA("Team")
local enemystats = hit.Parent:FindFirstChild("Stats")
if hum ~= nil and not hits[hit.Parent] and hit.Parent ~= char and team ~= nil and team.TeamColor ~= char.Team.TeamColor and enemystats ~= nil then
hits[hit.Parent] = true
ball.CanTouch = false
local defdamage = abilitystats.Damage.Value - enemystats.Defense.Value
task.wait()
local newdamage = defdamage * ((100 - enemystats.Resistance.Value) / 100)
if newdamage <= 0 then newdamage = 1 end
task.wait()
hum:TakeDamage(newdamage * charstats.DamageMult.Value)
local testpart = Instance.new("Part")
testpart.Parent = workspace
testpart.Name = "KBPart"
testpart.CanCollide = false
testpart.Anchored = true
testpart.Transparency = 1
testpart.Size = Vector3.new(2,2,1)
local lookpos = CFrame.new(hit.Parent.HumanoidRootPart.Position, rootpart.Position)
testpart.CFrame = lookpos
game.Debris:AddItem(testpart, 0.5)
local bvelo = Instance.new("BodyVelocity")
bvelo.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bvelo.Parent = hit.Parent.HumanoidRootPart
bvelo.Velocity = testpart.CFrame.LookVector * -100
game.Debris:AddItem(bvelo, 0.05)
task.wait(abilitystats.Cooldown.Value / charstats.Speed.Value)
hits[hit.Parent] = false
end
end)