I’ve also tried using cframe but that didn’t work aswell.
script:
while wait(0.8) do
local ShotParticle = script.Parent.LaserChargePart.ShotParticles
local LaserSphere = script.Parent -- Where the other part is supposed to be
local Laser = script.Parent.Laser -- The part that moves to the center of the baseplate
local Particle = script.Parent.LaserChargePart.Attachment.ParticleEmitter
local ParticleLight = Particle.LightEmission
local LaserSound = script.Parent.LaserChargePart.LaserSound
local LaserChargeSound = script.Parent.LaserChargePart.LaserChargeSound
local TS = game:GetService("TweenService")
local Destination = Vector3.new(LaserSphere.Position, 11.078, LaserSphere.Position)
local SizeDestination = Vector3.new(9.1, 0.4, 0.4)
local TweenInfoPosition = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out,0,false)
local TweenInfoSize = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out,0,false)
local ChangeSize = TS:Create(Laser, TweenInfoSize, {Size = SizeDestination})
local Bright = TS:Create(Particle,TweenInfo.new(1),{LightInfluence = 1000})
local ChangePosition = TS:Create(Laser, TweenInfoPosition, {Position = Destination})
local ChangeTransparancy = TS:Create(Laser, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out , 0, false),{Transparency = 1})
local Position = LaserSphere.Position
local Direction = -LaserSphere.CFrame.UpVector
local rcParams = RaycastParams.new()
rcParams.FilterDescendantsInstances = {LaserSphere,script.Parent.LaserChargePart}
rcParams.FilterType = Enum.RaycastFilterType.Exclude
local ray = workspace:Raycast(Position, Direction * 50)
if ray then
local Part = ray.Instance
print(Part)
local char = Part:FindFirstAncestorWhichIsA("Model")
if char ~= nil then
local h = char:findFirstChild("Humanoid")
if h ~= nil then
Particle.Enabled = true
Bright:Play()
LaserChargeSound:Play()
wait(1)
Particle.Enabled = false
ShotParticle.Enabled = true
ChangePosition:Play()
ChangeSize:Play()
LaserSound:Play()
h:TakeDamage(30)
wait(0.5)
ShotParticle.Enabled = false
wait(0.5)
ChangeTransparancy:Play()
wait(1)
Laser.Transparency = 0
Particle.LightInfluence = 0
Laser.Position = Vector3.new(LaserSphere.Position, 18.519, LaserSphere.Position)
Laser.Size = Vector3.new(1.8, 0.4, 0.4)
end
end
end
end
while wait(0.8) do
local ShotParticle = script.Parent.LaserChargePart.ShotParticles
local LaserSphere = script.Parent -- Where the other part is supposed to be
local Laser = script.Parent.Laser -- The part that moves to the center of the baseplate
local Particle = script.Parent.LaserChargePart.Attachment.ParticleEmitter
local ParticleLight = Particle.LightEmission
local LaserSound = script.Parent.LaserChargePart.LaserSound
local LaserChargeSound = script.Parent.LaserChargePart.LaserChargeSound
local TS = game:GetService("TweenService")
local Destination = Vector3.new(LaserSphere.Position, 11.078, LaserSphere.Position)
local SizeDestination = Vector3.new(9.1, 0.4, 0.4)
local TweenInfoPosition = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out,0,false)
local TweenInfoSize = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out,0,false)
local ChangeSize = TS:Create(Laser, TweenInfoSize, {Size = SizeDestination})
local Bright = TS:Create(Particle,TweenInfo.new(1),{LightInfluence = 1000})
local ChangePosition = TS:Create(Laser, TweenInfoPosition, {Position = Destination})
local ChangeTransparancy = TS:Create(Laser, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out , 0, false),{Transparency = 1})
local Position = LaserSphere.Position
local Direction = -LaserSphere.CFrame.UpVector
local rcParams = RaycastParams.new()
rcParams.FilterDescendantsInstances = {LaserSphere,script.Parent.LaserChargePart}
rcParams.FilterType = Enum.RaycastFilterType.Exclude
local ray = workspace:Raycast(Position, Direction * 50)
if ray then
local Part = ray.Instance
print(Part)
local char1 = Part:FindFirstAncestorWhichIsA("Model")
if char1 ~= nil then
local h = char1:findFirstChild("Humanoid")
if h ~= nil then
Particle.Enabled = true
Bright:Play()
LaserChargeSound:Play()
wait(1)
Particle.Enabled = false
ShotParticle.Enabled = true
ChangePosition:Play()
ChangeSize:Play()
LaserSound:Play()
h:TakeDamage(30)
wait(0.5)
ShotParticle.Enabled = false
wait(0.5)
ChangeTransparancy:Play()
wait(1)
Laser.Transparency = 0
Particle.LightInfluence = 0
Laser.Position = Vector3.new(LaserSphere.Position, 18.519, LaserSphere.Position)
Laser.Size = Vector3.new(1.8, 0.4, 0.4)
end
end
end
end