I am a beginner scripter and through experimentation I have made a non raycast gun that teleports a damage brick over to my mouse position when I click, and disappears almost instantly. However, I do not know how to work with FE, so my gun is broken wherever I want to use it. How can I convert my gun to FE? I will put the code below if it helps.
(Gun script)
local tool = script.Parent
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
local ammo = 12
local mag = 12
local reload = false
tool.Equipped:connect(function(mouse)
mouse.Button1Down:connect(function()
if ammo > 0 and reload == false then
tool.SlideBack.Transparency = 0
tool.Slide.Transparency = 1
tool.FireSound.TimePosition = 0
tool.FireSound.Playing = true
local oof = game.ServerStorage.Oofpart:Clone()
oof.BrickColor = BrickColor.Black()
oof.Size = Vector3.new(0.7,0.7,0.7)
oof.Position = mouse.Hit.p
oof.Transparency = 0
oof.Anchored = true
oof.CanCollide = false
oof.Parent = workspace
game:GetService("Debris"):AddItem(oof, 0.001)
wait(0.05)
tool.SlideBack.Transparency = 1
tool.Slide.Transparency = 0
end
end)
end)
(Damage brick script)
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
h.Health = h.Health - 27
script.Parent:Destroy()
end
end
script.Parent.Touched:connect(onTouched)
I know, the code is sloppy and inefficient, but it's my first gun. I have almost no experience with building stuff like this.

2 comments
Create the part on the server and not the client.
:connect() is deprecated, you should use :Connect(). You should use :FindFirstChild() instead of :findFirstChild(). Here is an article on deprecation: http://robloxdev.com/articles/Deprecation