Basketball Steal

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want whenever the player presses R they’ll steal the ball from the other player making it go into the workspace.
  2. What is the issue? Include screenshots / videos if possible!
    Whenever I walk up to the other player to attempt to steal the ball…nothing happens. It stays in the other players inventory. Idk if it’s the scripting or whatnot.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- This is an example Lua code block

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

It’s very difficult for us to understand this without providing actual snippets of the code rather than just pictures of it.

Can you copy paste the snippets into a lua block?

– Client Side
UIS.InputBegan:Connect(function(input, gameP)
if gameP then return end
if input.KeyCode == Enum.KeyCode.R then
if not player.Character:FindFirstChild(“Basketball”) then
print(player.Name… " Is Reaching")
StealDebounce = false
StealDebounce = true

– Server Side
local Basketball = player.Character.Basketball
if StealBall == false and Basketball.Parent ~= workspace and Basketball.Parent:FindFirstChild(“Humanoid”) and hit ~= player.Character:FindFirstChild(“RightHand”) then
Basketball.Parent = workspace
Basketball.Handle.Velocity =, 0, 0)
Basketball.Handle.RotVelocity =, 0, 10)
StealBall = true
StealBall = false

There…sorry it came out wonky tho!

You can use the lua code block ``` on the start and end of the code to create correct syntax highlighting.

If this is your actual code, you’ll need to re-check and line up the correct ‘ends’ with the ifs, events, etc. It seems you’re missing some in some places.

Alright thank you!! I’ll look out and rewrite em!!!

1 Like