Hi, I have this issue I’d like to resolve, and I can’t wrap my head around it. I created a simple throw tool script, but it throws the player slightly sometimes instead of the part. How can I fix this? Thanks for any help in advance!
Clip of what is happening:
LocalScript:
uis.InputBegan:Connect(function(input, istyping)
if istyping then return end
if input.KeyCode == Enum.KeyCode.T then
script.Parent.Script.Throw:FireServer()
end
end)
ServerScript:
script.Throw.OnServerEvent:Connect(function()
local humrp = script.Parent.Parent:FindFirstChild("HumanoidRootPart")
local direction = humrp.CFrame.LookVector + (humrp.CFrame.LookVector * 25)
script.Parent.Parent = workspace
script.Parent.Handle.CFrame = humrp.CFrame
script.Parent.Handle.CanCollide = false
local bv = Instance.new("BodyVelocity", script.Parent.Handle)
bv.MaxForce = Vector3.one * math.huge
bv.Velocity = direction
script.ThrowSFX:Play()
wait(0.08)
bv:Destroy()
wait(0.1)
script.Parent.Handle.CanCollide = true
end)