Why isn't the position being set?
So im trying to make a gun to my game, and it is working fine but when it came to the point to make the bullet appear and set it's position its wont work. Also i want to set its orientation to the mouse position, and also stop it at the closest object.
This is my script:
01 | local pistola = script.Parent |
02 | local hole = game.StarterPack.Pistola.Hole |
03 | local mouse = game.Players.LocalPlayer:GetMouse() |
09 | local headshotDamage = 50 |
17 | pistola.Activated:Connect( function () |
20 | pistola.Handle.Disparo:Play() |
21 | local bullet = Instance.new( "Part" ) |
22 | bullet.Size = Vector 3. new(range, 0.25 , 0.25 ) |
23 | bullet.Position = hole.Position |
24 | bullet.Transparency = 0.5 |
25 | bullet.CanCollide = false |
26 | bullet.Anchored = true |
27 | bullet.Parent = game.Workspace |
So here's a summary of my questions:
-Why isn't the position being set;
-How can i get the position of the mouse;
-How can i set the bullet size to stop when it hits something, like a wall or a player?
Thank you for helping me (if you did helped me XD)