Why isn't the position being set?
Asked by
6 years ago Edited 6 years ago
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 |
15 | pistola.Activated:Connect( function () |
18 | pistola.Handle.Disparo:Play() |
19 | local bullet = Instance.new( "Part" ) |
20 | bullet.Size = Vector 3. new(range, 0.25 , 0.25 ) |
21 | bullet.Position = hole.Position |
22 | bullet.Transparency = 0.5 |
23 | bullet.CanCollide = false |
24 | bullet.Anchored = true |
25 | bullet.Parent = game.Workspace |
So here's a summary of my questions: 1: Why isn't the position being set; 2: How can i get the position of the mouse; 3: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)
Also im using a local script, if you need to know...