Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Gun bullet velocity script in tool won’t work?

Hello. I am relatively new to making things move on its own so I just tried it and it’s hard. If I knew how to make the bullet move would know how to make a gun, so I tried but it didn’t work. Here’s the script:

local tool = script.Parent
local handle = tool.Handle
tool.Activated:Connect(function()
local bullet = Instance.new(“Part”, game.Workspace)
bullet.BrickColor = BrickColor.new(“Gold”)
bullet.CFrame = CFrame.new(handle.CFrame.X + 3, handle.CFrame.Y, handle.CFrame.Z)
bullet.Velocity = 90
bullet.Anchored = true

local damageScript = game.ServerStorage.bulletDamage
damageScript.Parent = bullet

end)

1 answer

✓ Accepted answer

Velocity needs to be Vector3.

local tool = script.Parent
local handle = tool:WaitForChild("Handle")
tool.Activated:Connect(function()
	local bullet = Instance.new("Part")
	bullet.BrickColor = BrickColor.new("Gold")
	bullet.CFrame = CFrame.new(handle.CFrame.X + 3, handle.CFrame.Y, handle.CFrame.Z)
	bullet.Velocity = handle.CFrame.LookVector.Unit * 90
	bullet.Parent = workspace
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.