Why my bullet does not work

So i have created a script that would shoot when you press q but when i press q the bullet just spawns and does nothing. I want so my bullet would go in the direction where the gun is pointing at

--
local remote = game.ReplicatedStorage.Block1
local block = game.ReplicatedStorage.Block.Handle




remote.OnServerEvent:Connect(function(player,mouse)
  
  local shootingPart =player.Character:FindFirstChild('Block').Handle
  local bullet = block:Clone()
  bullet.Position = shootingPart.Position
  bullet.Parent =game.Workspace
  local bodyVelocity = Instance.new("LinearVelocity")
  bodyVelocity.MaxForce = 10000000
  bodyVelocity.VectorVelocity = shootingPart.CFrame.LookVector * 100
  
end)
3 Likes

You forgot to set bodyVelocity to the bullet parent.

remote.OnServerEvent:Connect(function(player,mouse)
  
  local shootingPart =player.Character:FindFirstChild('Block').Handle
  local bullet = block:Clone()
  bullet.Position = shootingPart.Position
  bullet.Parent =game.Workspace
  local bodyVelocity = Instance.new("LinearVelocity")
  bodyVelocity.MaxForce = 10000000
  bodyVelocity.VectorVelocity = shootingPart.CFrame.LookVector * 100
  bodyVelocity.Parent = bullet
end)
1 Like

i tried that but still the bullet does not move

1 Like

Check to make sure the block (bullet) is unanchored and refer to the documentation of LinearVelocity to check if all your properties are set properly for VectorVelocity to work. If an attachment is needed, add one and connect it.

1 Like

oh ok thanks i figured it out apreciate it

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.