Hello, first thanks for reading this. So I am using the wiki tutorial on making a raycast gun but I run the code with FE turned on and the Button1Down() function won't fire. I am trying to figure out how to make my own. I don't want someone to tell me what to do. But if you could point me in the right direction of fixing the problem it would be appreciated. :-)
local tool = script.Parent local player tool.Equipped:connect(function(mouse) player = game.Players:FindFirstChild(script.Parent.Parent.Name) print("Tool equipped!") mouse.Button1Down:connect(function() print("Mouse pressed!") local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit * 300) local part, position = workspace:FindPartOnRay(ray, player.Character, false, true) local beam = Instance.new("Part", workspace) beam.BrickColor = BrickColor.new("Bright red") beam.FormFactor = "Custom" beam.Material = "Neon" beam.Transparency = 0.25 beam.Anchored = true beam.Locked = true beam.CanCollide = false local distance = (tool.Handle.CFrame.p - position).magnitude beam.Size = Vector3.new(0.3, 0.3, distance) beam.CFrame = CFrame.new(tool.Handle.CFrame.p, position) * CFrame.new(0, 0, -distance / 2) game:GetService("Debris"):AddItem(beam, 0.1) if part then local humanoid = part.Parent:FindFirstChild("Humanoid") if not humanoid then humanoid = part.Parent.Parent:FindFirstChild("Humanoid") end if humanoid then humanoid:TakeDamage(30) end end end) end)
FilteringEnabled stops the server from accepting the game state of the client. What this means for you is that the server doesn't know that you clicked.
Solution
Check for the mouse events on the client using a LocalScript, and tell the server that you clicked using a RemoteEvent