Why is it So that my Filtering Enabled Gun Works in Studio, but not in the Real Game?
My filtering enabled gun works fine in studio, but the bullet just floats in game. I need some help
Would it be that my filtering enabled gun script shouldn't be in the workspace, or is there another problem?
Local Script for Gun Tool
01 | Player = game.Players.LocalPlayer |
04 | script.Parent.Equipped:connect( function (Mouse) |
05 | Gui = script.Parent.AmoGui:clone() |
06 | Gui.Parent = Player.PlayerGui |
07 | Mouse.Button 1 Down:connect( function () |
09 | workspace.FE.PistolShot.Shot:FireServer() |
11 | Gui.BG.Text.Text = Ammo.. "/10" |
14 | Mouse.KeyDown:connect( function (Key) |
15 | if Key = = "r" and Ammo < 10 then |
16 | Gui.BG.Text.Text = "Reloading..." |
17 | workspace.FE.PistolShot.Reload:FireServer() |
20 | Gui.BG.Text.Text = Ammo.. "/10" |
24 | script.Parent.Unequipped:connect( function () |
Script for Shooting Gun
02 | script.Shot.OnServerEvent:connect( function (Client) |
03 | local R = script.GunShot:clone() |
04 | R.Parent = Client.Character.Pistol.Handle |
06 | Bullet = Instance.new( "Part" , workspace) |
07 | Bullet.Size = Vector 3. new( 1 , 1 , 1 ) |
08 | Bullet.Transparency = 1 |
09 | local Trail = script.Beam:Clone() |
12 | local A 0 = Instance.new( "Attachment" , Client.Character.Pistol.Handle) |
13 | local A 1 = Instance.new( "Attachment" , Bullet) |
14 | Trail.Attachment 0 = A 0 |
15 | Trail.Attachment 1 = A 1 |
16 | Bullet.CFrame = Client.Character.Pistol.Handle.CFrame |
17 | local Shoot = Instance.new( "BodyVelocity" , Bullet) |
18 | Bullet.Anchored = false |
19 | Bullet.CanCollide = false |
20 | Shoot.Velocity = CFrame.new(Bullet.CFrame.p, Client:GetMouse().Hit.p).lookVector * 900 |
21 | Shoot.MaxForce = Vector 3. new( math.huge , math.huge , math.huge ) |
22 | Bullet.Touched:connect( function (hit) |
23 | if hit.Parent:FindFirstChild( "Humanoid" ) ~ = nil then |
24 | if hit.Parent.Name ~ = Client.Name then |
25 | Bullet.Anchored = true |
26 | if hit.Name ~ = "Head" then |
27 | hit.Parent.Humanoid:TakeDamage( 10 ) |
28 | elseif hit.Name = = "Head" then |
29 | hit.Parent.Humanoid:TakeDamage( 50 ) |
32 | hit.Parent.Killer.Value = Client.Name |
36 | game:GetService( "Debris" ):AddItem(Bullet, 1 ) |
38 | script.Reload.OnServerEvent:connect( function (Client) |
39 | local R = script.ReloadSound:clone() |
40 | R.Parent = Client.Character.Pistol.Handle |