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

This shooting script does not work at all, does not shoot?

Asked by 1 year ago

This following script is supposed to instance a new part, and make it shoot towards the player but it dosent do that! Thanks for the help

local function Shoot()

    local bullet ="Part", workspace.Bullets.EnemyBullets)
    bullet.Size =,0.3,0.3)
    bullet.Material = "Neon"

    bullet.CFrame = Enemy.Torso.CFrame *,0,-4)
    bullet.CanCollide = false

    local velocity ="BodyVelocity", bullet)
    velocity.MaxForce =,math.huge,math.huge)
    bullet.CFrame =, game.Players.LocalPlayer.Character.HumanoidRootPart.Position)
    velocity.Velocity = bullet.CFrame.lookVector * 500 +,25),math.random(-25,25),0)


while wait(2) do


Is the script a LocalScript? Jac_00b 157 — 1y
yes it is. I've tried it in a server script and didn't change anything KoalaKo_XD 27 — 1y

1 answer

Log in to vote
Answered by
Jac_00b 157
1 year ago
Edited 1 year ago

You said in the comments that this was in a LocalScript. LocalScripts are meant for things that only the client can see, so no other clients in the server will be able to see the bullet. However, it's not as easy as just switching it to a server script, as you referenced game.Players.LocalPlayer, which only LocalScripts can use.

Assuming that this script is in a Tool, then we can easily access the Character, as equipped tools are in the character model itself. If the script is under the Tool directly, then you can reference script.Parent.Parent to get the character. If it's in the handle, add an extra .Parent to compensate for it. (The new line below shows it as if it is under the Tool directly)

So, the script should be changed to a server script, and the new line 12 should be:

bullet.CFrame =, script.Parent.Parent.HumanoidRootPart.Position)

Hope this helped.


Answer this question