Alright so im making a Grenade Throwing System Thingy and im facing a little problem,
Changing The Parent affects The BodyVelocity
So far i have tried using task.wait after the change of parent with diff Cooldowns but it doesnt work at all
Here is my script
Arg1 and Arg2 is just player and mouse.hit.position
local Knit = require(game:GetService("ReplicatedStorage"):WaitForChild("Packages").Knit)
local CAS = game:GetService("ContextActionService")
local REP = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local ThrowingService = Knit.CreateService {
Name = "ThrowingService"
}
function ThrowingService:KnitInit()
end
function ThrowingService:KnitStart()
end
function ThrowGrenade(Grenade, HRP, MouseHit)
Grenade.PrimaryPart = Grenade.Handle
Grenade.Handle.Anchored = false
task.wait(0.03)
local BV = Instance.new("BodyVelocity")
BV.MaxForce = Vector3.new(1e5, 1e5, 1e5)
BV.Velocity = CFrame.new(Grenade.Handle.Position, MouseHit).LookVector * 60 + Vector3.new(0, 10, 0)
BV.P = 10000
BV.Parent = Grenade.Handle
game:GetService("Debris"):AddItem(BV, 0.5)
end
function ThrowingService.Client:Throw(Arg1, Arg2)
local LPLAYER = Arg1
local Char = LPLAYER.Character
--print(Arg2)
local Grenade = Char:FindFirstChild("Kaboom")
if not Grenade then return end
Grenade.Parent = workspace
task.wait(1)
ThrowGrenade(Grenade, Char.HumanoidRootPart, Arg2)
print("Ran")
end
return ThrowingService