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

Simple "gun" is not working correctly?

Asked by 5 years ago
Player = game.Players.LocalPlayer

Mouse = Player:GetMouse()



Mouse.Button1Down:Connect(function(Key)

print(Mouse.Hit.Position)

local Position = (Mouse.Hit.Position - game.Players.LocalPlayer.Character.Torso.Position).magnitude

local Bullet = Instance.new("Part")

Bullet.Anchored = true

Bullet.CanCollide = false

Bullet.Material = Enum.Material.Neon

Bullet.BrickColor = BrickColor.new("Wheat")

Bullet.CFrame = CFrame.new(game.Players.LocalPlayer.Character.Head.CFrame.Position)

Bullet.Size = Vector3.new(0.2,0.2,Position)

Bullet.Parent = workspace

Bullet.Orientation = game.Players.LocalPlayer.Character.Head.Orientation

end)

The bullet spawn inside the player, each long each way. I tried with ray but it just errors. Help?

0
In this case, Ray Casting may be what you're looking for. namespace25 594 — 5y

Answer this question