Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
SoundModule = require(game.ReplicatedStorage.SoundModule)
Damage = require(game.ReplicatedStorage.DamageModule)
Players = game:GetService("Players")
Speed = 100
Duration = 1
ServerControl = Tool.ServerControl
ClientControl = Tool.ClientControl
NozzleOffset = Vector3.new(0, 0, -15)
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character.Humanoid
if Humanoid.Health == 0 then
return
end
end
Tool.ServerControl.OnServerEvent:Connect(function(player, Mode, Value, arg)
if Mode == "Click" and Value then
Activated(arg)
print("Fired")
end
end)
function Activated(target)
if Tool.Enabled then
Tool.Enabled = false
local HandleCFrame = Handle.CFrame
local FiringPoint = HandleCFrame.p + HandleCFrame:vectorToWorldSpace(NozzleOffset)
local ShotCFrame = CFrame.new(FiringPoint, target)
local LazerShot = BaseShot:Clone()
Damage.Damage(LazerShot,Tool.Parent.Humanoid, 14, 1)
LazerShot.CFrame = ShotCFrame + (ShotCFrame.LookVector * (BaseShot.Size.Z/2))
--local BodyVelocity = Instance.new("BodyVelocity")
--BodyVelocity.velocity = ShotCFrame.lookVector * Speed
--BodyVelocity.Parent = LazerShot
LazerShot.Parent = Tool.Parent
SoundModule.Sound(Tool.Handle.Fire, Tool.Parent.Torso, .6, 0)
wait(.5)
spawn(function()
for i = 0, 1, 0.08 do
wait()
LazerShot.Transparency = i
end
LazerShot:Destroy()
end)
Tool.Enabled = true
end
end
BaseShot = Instance.new("Part")
BaseShot.Anchored = true
BaseShot.Name = "Effect"
BaseShot.BrickColor = BrickColor.new("Bright green")
BaseShot.Material = Enum.Material.Neon
BaseShot.Shape = Enum.PartType.Block
BaseShot.TopSurface = Enum.SurfaceType.Smooth
BaseShot.BottomSurface = Enum.SurfaceType.Smooth
BaseShot.FormFactor = Enum.FormFactor.Custom
BaseShot.Size = Vector3.new(0.5, 0.5, 55)
BaseShot.CanCollide = false
✓ ANSWER ACCEPTED
Why can't I see the LazerShot when my character is in first person?
1 answer
✓ Accepted answer
Its cause your parenting it to the character. When you go in first person. Everything in the character becomes completely transparent. I'd recommend adding it to the workspace. Maybe the tool. But parenting it to the tool's parent parents it to the character. and that just won't work.
What i would personally recommend is using game:getService("Debris")
So i'll try editing your script to use "Debris". Just minor differences
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
SoundModule = require(game.ReplicatedStorage.SoundModule)
Damage = require(game.ReplicatedStorage.DamageModule)
local Debris = game:GetService("Debris") ---Define The Service "Debris"
Players = game:GetService("Players")
Speed = 100
Duration = 1
ServerControl = Tool.ServerControl
ClientControl = Tool.ClientControl
NozzleOffset = Vector3.new(0, 0, -15)
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character.Humanoid
if Humanoid.Health == 0 then
return
end
end
Tool.ServerControl.OnServerEvent:Connect(function(player, Mode, Value, arg)
if Mode == "Click" and Value then
Activated(arg)
print("Fired")
end
end)
function Activated(target)
if Tool.Enabled then
Tool.Enabled = false
local HandleCFrame = Handle.CFrame
local FiringPoint = HandleCFrame.p + HandleCFrame:vectorToWorldSpace(NozzleOffset)
local ShotCFrame = CFrame.new(FiringPoint, target)
local LazerShot = BaseShot:Clone()
Damage.Damage(LazerShot,Tool.Parent.Humanoid, 14, 1)
LazerShot.CFrame = ShotCFrame + (ShotCFrame.LookVector * (BaseShot.Size.Z/2))
--local BodyVelocity = Instance.new("BodyVelocity")
--BodyVelocity.velocity = ShotCFrame.lookVector * Speed
--BodyVelocity.Parent = LazerShot
Debris:AddItem(LazerShot, 10 -- The time you want the lazershot to bed active/not destroyed, So after 10 seconds in this script it will be destroyed)
LazerShot.Parent = workspace -- So it doesnt disappear when you zoom in
SoundModule.Sound(Tool.Handle.Fire, Tool.Parent.Torso, .6, 0)
wait(.5)
spawn(function()
for i = 0, 1, 0.08 do
wait()
LazerShot.Transparency = i
end
LazerShot:Destroy()
end)
Tool.Enabled = true
end
end
BaseShot = Instance.new("Part")
BaseShot.Anchored = true
BaseShot.Name = "Effect"
BaseShot.BrickColor = BrickColor.new("Bright green")
BaseShot.Material = Enum.Material.Neon
BaseShot.Shape = Enum.PartType.Block
BaseShot.TopSurface = Enum.SurfaceType.Smooth
BaseShot.BottomSurface = Enum.SurfaceType.Smooth
BaseShot.FormFactor = Enum.FormFactor.Custom
BaseShot.Size = Vector3.new(0.5, 0.5, 55)
BaseShot.CanCollide = false
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
But then how would I make it so that the lazer is destroyed when the character dies?
You dont, Try using debris service, I'll edit my answer now
Tell if it works now