Can not aim bullet at the mouses target?
I have got a local script inside a gun sending. data through a remote event and it will not aim the bullet. here its my code for the script:
01 | game.ReplicatedStorage:WaitForChild( "Shoot" ).OnServerEvent:Connect( function (plr,mouse) |
03 | local tool = plr.Character.Pew |
04 | local cords = tool.Handle.Position |
05 | local bullet = Instance.new( "Part" ) |
06 | bullet.Material = Enum.Material.Neon |
07 | bullet.BrickColor = BrickColor.new( "Dark blue" ) |
08 | bullet.Anchored = true |
09 | bullet.CanCollide = false |
10 | bullet.Size = Vector 3. new( 4 , 0.71 , 0.76 ) |
11 | bullet.Parent = tool.Handle |
12 | bullet.CFrame = tool.Handle.CFrame + Vector 3. new( 0 , 0 , 0 ) |
13 | bullet.CFrame = CFrame.new(bullet.CFrame.p, mouse.Hit.p) |
here is my code for the local script:
1 | local RS = game:GetService( "ReplicatedStorage" ) |
2 | local mouse = game.Players.LocalPlayer:GetMouse() |
3 | local player = game:GetService( "Players" ).LocalPlayer |
4 | local mouse = player:GetMouse() |
6 | script.Parent.Activated:Connect( function () |
7 | local plr = script.Parent.Handle |
8 | RS.Shoot:FireServer(plr,mouse) |
why does it do this I am using something I used in the past and it worked fine?