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

Bullet doesn't move for some reason?

Asked by 2 years ago

So I made a gun that uses Instance.new() The problem Is the bullet not going foward

SCRIPT:

local tool = script.Parent
local debounce = false

tool.Activated:Connect(function()
    if debounce == false then
        debounce = true
        local newBullet = Instance.new("Part")
        local Thrust = Instance.new("VectorForce")
        local Attachment = Instance.new("Attachment")

        newBullet.Parent = game.Workspace
        Thrust.Parent = newBullet
        Attachment.Parent = newBullet
        newBullet.Size = Vector3.new(1,1,1)
        Thrust.Force = Vector3.new(10000,300,0)
        newBullet.BrickColor = BrickColor.Yellow()
        newBullet.Anchored = false
        newBullet.Position = script.Parent.Launcher.Position
        newBullet.Orientation = script.Parent.Launcher.Orientation
        newBullet.Touched:Connect(function(hit)
            local humanoid = hit.Parent:WaitForChild("Humanoid")
            if humanoid then
                humanoid:TakeDamage(100)
            end
        end)
        wait(3)
        newBullet:Destroy()
        debounce = false
    end
end)

1 answer

Log in to vote
2
Answered by 2 years ago

Hey, it's me again. TheVectorForce Attachment0 property was never set, it's basically where the thrust is exerted, you added the attachment to the part but never set the property on the Vector Force. Just add this after Attachment was declared, Thrust.Attachment0 = Attachment. I hope this helped. Good Luck!

0
Oooooh I forgot! Thank you! imnotaguest1121 362 — 2y
0
I'm glad it worked! If so please mark it as the answer, thank you! strangejmaster43 139 — 2y
Ad

Answer this question