#i coded something that the ball gets attached to the player after touching it

34 messages · Page 1 of 1 (latest)

open night
#

local ball = script.Parent
local debounce = false

local function resetVelocity()
ball.AssemblyLinearVelocity = Vector3.new(0, 0, 0)
ball.AssemblyAngularVelocity = Vector3.new(0, 0, 0)
end

local function stabilizeBall()
while ball.Parent and ball.Parent:IsA("Model") do
wait(1) -- Alle 1 Sekunde stabilisieren
resetVelocity()
end
end

ball.Touched:Connect(function(hit)
if debounce then return end
debounce = true

local character = hit.Parent
local player = game.Players:GetPlayerFromCharacter(character)

if player then
    if ball.Parent == character then debounce = false return end  

    local leftLeg = character:FindFirstChild("Left Leg")
    local rightLeg = character:FindFirstChild("Right Leg")
    local targetLeg = leftLeg or rightLeg  

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

        ball.Parent = character  
        ball.Anchored = false
        ball.CanCollide = false  
        ball:SetNetworkOwner(nil)  

        ball.Position = targetLeg.Position + Vector3.new(0, 1, 0)  
        resetVelocity()

        local motor = Instance.new("Motor6D")
        motor.Part0 = targetLeg
        motor.Part1 = ball
        motor.C0 = CFrame.new(0, -1, 0)
        motor.Parent = ball  

        -- Stabilisierung starten
        task.spawn(stabilizeBall)

        wait(0.2)  
        debounce = false
    end
else
    debounce = false
end

end)

rose tinsel
#

Hmm

#

If your trying to script the ball, then welp idk

#

I used animations

#

Use a tutorial

#

If needed

#

But like idk

open night
#

u got a tutorial?

rose tinsel
#

Hold on

open night
#

ight

rose tinsel
#

Wait a minute

eternal cedarBOT
#

studio** You are now Level 5! **studio

open night
#

sure

rose tinsel
#

Wait i could prob help

open night
#

id appreciate it a lot

cerulean lotus
#

and what about this one? motor.C0 = CFrame.new(0, -1, 0)

open night
cerulean lotus
#

what is state of leg.cancollide?

#

coz i think the ball is colliding with leg

open night
#

ohh

eternal cedarBOT
#

studio** You are now Level 1! **studio

open night
#

but how do i fix this

cerulean lotus
#

it's not the leg it's connect to that is colliding with, it's the other leg

#

.cancollide=false on both legs?

#

also either remove this line ball:SetNetworkOwner(nil) or change it to give network ownership of the ball to the player

#

since you're constraining the ball to the player's character, the player should have ownership of it.

open night
#

ic

open night
cerulean lotus
open night
#

ight ty also @primal hedge you found something?

#

it would be easier if i could jsut send a video of the issue