Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I make a ball curve script? My current script won't work. Here it is.

Asked by 3 years ago

So, I'm trying to make a curve script in my game that curves the ball when it kicked(like when you kick it it curves). I've tried looking for so long but couldn't find an answer.

When I press C the ball does move but not curve

Here is my code for the curve script. All help is appreciated!

local UserInputService = game:GetService("UserInputService")
local Animation = script.Animation

local Player = game.Players.LocalPlayer


UserInputService.InputBegan:Connect(function(Input)
    if Input.KeyCode == Enum.KeyCode.C  then
        local Char = Player.Character
        local Humanoid = Char.Humanoid
        local Anim = Humanoid:LoadAnimation(Animation)
        Anim:Play()

        Player.Character["Right Leg"].Touched:connect(function(hit)
            print("hit leg")
            if hit.Name == "Ball" and hit.Anchored == false  then
                Anim:Play()


                local Force = Instance.new("BodyVelocity")
                Force.Velocity = (Player.Character.HumanoidRootPart.CFrame * CFrame.fromEulerAnglesXYZ(0.5, 0, 0)).lookVector * (99 + math.random(-10, 25))
                Force.Velocity = Force.Velocity * Vector3.new(1, 0, 1)
                Force.Velocity =  Player.Character["Right Leg"].CFrame.lookVector * 100
                Force.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
                Force.Parent = hit


                game.Debris:AddItem(Force, 0.3)

                local AngleForce = Instance.new("AngularVelocity")
                AngleForce.AngularVelocity = AngleForce.AngularVelocity * Vector3.new(0,10,1000)
                AngleForce.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
                AngleForce.Parent = hit

                game.Debris:AddItem(AngleForce, 0.4)


            end
        end)
    end
end)
0
Have you tried setting the parent first and then changing anything else? boomthefist 6 — 3y
0
Yes Mah7866 0 — 3y

Answer this question