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

My AWP's bullet position not doing to the right place?

Asked by 2 years ago

So I had this problem where my AWP gun that uses Instance.new() bullet appear to not start from the tip of the launcher but rather the bullet Instead puts It self In the middle of the launcher part of the AWP when I actually want It to set the bullet position correctly. (To make It simpler I want the bottom of the bullet as the start of where the launcher Is)

SCRIPT:

local tool = script.Parent --Describes the tool

tool.Activated:Connect(function() ---Whenever the tool Is clicked when equipped
    local BulletPart = Instance.new("Part") ---Makes a new part

    BulletPart.BrickColor = BrickColor.Yellow() ---Brick color
    BulletPart.Parent = game.Workspace ---We parent the bullet to workspace
    BulletPart.Position = script.Parent.Launcher.Position ---We set the position of bullet
    BulletPart.Orientation = script.Parent.Launcher.Orientation ---Like the same but of the orientation
    BulletPart.Anchored = true ---Makes sure the bullet Is anchored
    BulletPart.Size = Vector3.new(0.409, 0.34, 187.109) ---Size (or range) of the bullet
    BulletPart.Touched:Connect(function(hit) ----- Whenever a bullet touched a humanoid (NOTE THIS WILL ONLY DAMAGE PLAYERS, NOT NPCS)
        local Humanoid = hit.Parent:WaitForChild("Humanoid") --- We descrive the humanoid whenever to part Is touched
        if Humanoid then ---If the model Is a humanoid
            Humanoid:TakeDamage(math.random(5,10)) ----We damaged the player (Also I used math.random to give a random player random damage)
        end
    end)
    wait(0.05) ---Waits 0.05 seconds
    BulletPart:Destroy() ---This deletes the bullet part to well, prevent lag
end)
1
So the bullet is spawning at the end of the barrel outside of the AWP but you want it to spawn in the barrel of the gun? strangejmaster43 139 — 2y
0
Some what correct imnotaguest1121 362 — 2y

Answer this question