Still have questions? Join our Discord server and get real time help.
Log in to vote

Can someone help me figure out what I'm doing wrong?

Asked by 4 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

Just trying to shoot a basic bullet, still new to this, so I wasn't sure where else to go. I've been following some tutorials, but for some reason I keep getting a blue underline under the first "Bullet" and "Workspace"

Player = game.Players.LocalPlayer
Gun = script.Parent
Ammo = 5
mouse = Player:GetMouse()
function Shoot()
    if Ammo > 0 then
        Bullet ="Part", Workspace)
        game.Debris:AddItem(Bullet, 2)
        Bullet.Shape = "Ball"
        Bullet.Size =, 0.2, 0.2)
        Bullet.TopSurface = "Smooth"
        Bullet.BottomSurface = "Smooth"
        Bullet.BrickColor ="Dark stone grey")
        Bullet.CanCollide = false
        Bullet.CFrame = Gun.Handle.Cframe
        Bullet.CFrame =, mouse.Hit.p)
        v ="BodyVelocity", Bullet)
        v.velocity = Bullet.CFrame.lookVector *90
        v.maxForce =, math.huge, math.huge)



1 answer

Log in to vote
Answered by
BlueTaslem 17347 Moderation Voter Administrator Community Moderator Super Administrator
4 years ago

The blue underlines, in this case, aren't actual errors. In this case they are harmless, but you should still correct it for, at the least, force of habit.

They are warnings that ROBLOX is guessing you're doing something bad.

It wants you to make Bullet local to the function (define it as local Bullet = Instance....) because using local variables is best practice.

It also wants you to use workspace instead of Workspace. While both work, ROBLOX has deprecated the Workspace variable (meaning they try to discourage people from using it) probably because it doesn't follow Lua's standard naming convention of using first-letter-lowercase-names.

The line in question would be corrected to this:

local Bullet ="Part", workspace)

Answer this question