#Basketball shooting not working

1 messages · Page 1 of 1 (latest)

carmine mulch
#
shootevent.OnServerEvent:Connect(function(plr,targetpos)
    local character = plr.Character
    local ball = character:FindFirstChild("Handle")
    local hand = character:FindFirstChild("RightHand")

    for _, c in pairs(hand:GetChildren()) do
        if c:IsA("Motor6D") or c:IsA("Weld") or c:IsA("WeldConstraint") then
            c:Destroy()
        end
    end

    for _, f in pairs(ball:GetChildren()) do
        if f:IsA("BodyMover") or f:IsA("AlignPosition") or f:IsA("AlignOrientation") then
            f:Destroy()
        end
    end

    local t = 0.5
    local g = Vector3.new(0, -workspace.Gravity, 0)
    local x0 = hand.Position + hand.CFrame.LookVector
    local v0 = (targetpos - x0 - 0.5 * g * t * t) / t

    ball.Anchored = false
    ball.Velocity = Vector3.zero
    ball.CanCollide = true

    local bv = Instance.new("BodyVelocity")
    bv.Velocity = v0
    bv.MaxForce = Vector3.new(1e5, 1e5, 1e5)
    bv.P = 1250
    bv.Parent = ball

    ball.Parent = workspace
    game:GetService("Debris"):AddItem(bv, t + 0.5)
end)

Why is the shooting animation not working - DISCLAIMER as the video will show the problem isnt that tjhe function fires - it does the ball just does not go where I want it to.

topaz lynx
#

you destroyed the motor 6d?

#

which, why would you do that in the first place?

#

w username btw, may His name be praised

carmine mulch
#

Amen

#

@topaz lynx I didnt mean an ACTUAL animation

#

I meant like teh projectile motion of the ball

#

also watch the video because the ball just goes nowhere near the rim

topaz lynx
#

for me its just a black box

#

the video

#

is the bar finding out how perfect the shot will be?

carmine mulch
#

nah

#

it weill be but i havent coded that yet

#

I am jsut trying to make it actual go into the hoop rn

#

@topaz lynx

#

also cant you see the ball fly off nowhere near the rim

topaz lynx
#

mhm

#

you need to some fun lil physics with it to figure out how far its suppost to go and how high its suppost to go

#

most likely you will need to use these equations to predict them

#

ok idk what im doing but ive watched this video that is related to your issue https://youtu.be/OlZk66luZYo?si=CpSiipwvu9gW_D71

Discord: https://discord.gg/bEn49K5JUt
Patreon: https://www.patreon.com/Suphi
Donate: https://www.roblox.com/games/7532473490

ApplyImpulse: https://create.roblox.com/docs/reference/engine/classes/BasePart#ApplyImpulse

0:00:00 - Intro
0:00:33 - Create Project
0:01:29 - Script
0:08:18 - Projectile Duration
0:14:24 - Target Velocity
0:17:40 - Outro

▶ Play video
carmine mulch
#

so what I did in my scripting was WROMNG @topaz lynx