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

How do i make the ball shoot smoothly?

Asked by 9 years ago
local enabled = true
Player = game.Players.LocalPlayer
while not Player.Character do wait(.03) end
character = Player.Character
mouse = Player:GetMouse()
run = game:GetService("RunService")

function onKeyDown(key)
    key = key:lower()
    if key == "z" then
        game:GetService("Chat"):Chat(Player.Character.Head, "Paper!")
        local b = Instance.new("Part")
        b.BrickColor = BrickColor.new("Neon orange")
        b.Shape = "Ball"
        b.Size = Vector3.new(2, 2, 2)
        b.TopSurface = "Smooth"
        b.BottomSurface = "Smooth"
        b.CanCollide = false
        b.Parent = workspace
        local b2 = Instance.new("Part")
        b2.BrickColor = BrickColor.new("Bright yellow")
        b2.Shape = "Ball"
        b2.Size = Vector3.new(4, 4, 4)
        b2.TopSurface = "Smooth"
        b2.BottomSurface = "Smooth"
        b2.CanCollide = false
        b2.Transparency = 0.7
        b2.Parent = b
        local weld = Instance.new("Weld")
        weld.Part0 = b
        --weld.C0 = b.CFrame:inverse()
        weld.Part1 = Player.Character["Right Arm"]
        weld.Parent = Player.Character["Right Arm"]
        local weld2 = Instance.new("Weld")
        weld2.Part0 = b2
        --weld2.C0 = b2.CFrame:inverse()
        weld2.Part1 = b
        weld2.Parent = b 
        game.Debris:AddItem(weld,0.1)
         local y = Instance.new("BodyVelocity")
        y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
        y.velocity = Player.Character.Torso.CFrame.lookVector*80
        y.Parent = b
        game.Debris:AddItem(b,6)        
    end
end


mouse.KeyDown:connect(onKeyDown)

The ball stutters when it shoots,and yes this is an local script.

Answer this question