this code. local TweenService = game:GetService("TweenService") local RunService = game:GetService("RunService")
local BASE_SIZE = 150 local WINDUP_SIZE = BASE_SIZE * 25 local MIN_SIZE = 15 local FLOAT_HEIGHT = 2 local FLOAT_DURATION = 2 local WINDUP_DURATION = 9.25 local APPEAR_DELAY = 0.5 local SHRINK_DURATION = 3.25 local BASE_TEXTURE_SPEED = 0.325 local WINDUP_TEXTURE_SPEED = 50
-- Create a container for all visual elements local container = Instance.new("Folder") container.Name = "BeamVisuals" container.Parent = workspace
-- Create attachments directly in workspace local attachment1 = Instance.new("Attachment") attachment1.Name = "Attachment1" attachment1.Position = Vector3.new(0, 0, -1 * BASE_SIZE) attachment1.Parent = container
local attachment2 = Instance.new("Attachment") attachment2.Name = "Attachment2" attachment2.Position = Vector3.new(0, 0, 1 * BASE_SIZE) attachment2.Parent = container
local redAttachment1 = Instance.new("Attachment") redAttachment1.Name = "RedAttachment1" redAttachment1.Position = Vector3.new(0, 0, -1 * BASE_SIZE) redAttachment1.Parent = container
local redAttachment2 = Instance.new("Attachment") redAttachment2.Name = "RedAttachment2" redAttachment2.Position = Vector3.new(0, 0, 1 * BASE_SIZE) redAttachment2.Parent = container
-- Create beams local beam1 = Instance.new("Beam") beam1.CurveSize1 = -1.35 * BASE_SIZE beam1.CurveSize0 = 1.35 * BASE_SIZE beam1.LightInfluence = 1 beam1.Segments = 999 beam1.TextureSpeed = BASE_TEXTURE_SPEED beam1.Width1 = 999999 beam1.Width0 = 999999 beam1.Transparency = NumberSequence.new(0) beam1.TextureLength = 5 beam1.LightEmission = 0.75 beam1.Texture = "rbxassetid://124670965229302" beam1.Attachment0 = attachment1 beam1.Attachment1 = attachment2 beam1.Enabled = false beam1.Parent = container
local beam2 = Instance.new("Beam") beam2.CurveSize1 = 1.35 * BASE_SIZE beam2.CurveSize0 = -1.35 * BASE_SIZE beam2.LightInfluence = 1 beam2.Segments = 999 beam2.TextureSpeed = -BASE_TEXTURE_SPEED beam2.Width1 = 999999 beam2.Width0 = 999999 beam2.Transparency = NumberSequence.new(0) beam2.TextureLength = 5 beam2.LightEmission = 0.75 beam2.Texture = "rbxassetid://124670965229302" beam2.Attachment0 = attachment1 beam2.Attachment1 = attachment2 beam2.Enabled = false beam2.Parent = container
local redBeam1 = Instance.new("Beam") redBeam1.CurveSize1 = -1.35 * BASE_SIZE redBeam1.CurveSize0 = 1.35 * BASE_SIZE redBeam1.LightInfluence = 1 redBeam1.Segments = 999 redBeam1.TextureSpeed = BASE_TEXTURE_SPEED redBeam1.Width1 = 999999 redBeam1.Width0 = 999999 redBeam1.Transparency = NumberSequence.new(0) redBeam1.TextureLength = 5 redBeam1.LightEmission = 1.5 redBeam1.Color = ColorSequence.new(Color3.fromRGB(255, 0, 0)) redBeam1.Texture = "rbxassetid://124670965229302" redBeam1.Attachment0 = redAttachment1 redBeam1.Attachment1 = redAttachment2 redBeam1.Enabled = false redBeam1.Parent = container
local redBeam2 = Instance.new("Beam") redBeam2.CurveSize1 = 1.35 * BASE_SIZE redBeam2.CurveSize0 = -1.35 * BASE_SIZE redBeam2.LightInfluence = 1 redBeam2.Segments = 999 redBeam2.TextureSpeed = -BASE_TEXTURE_SPEED redBeam2.Width1 = 999999 redBeam2.Width0 = 999999 redBeam2.Transparency = NumberSequence.new(0) redBeam2.TextureLength = 5 redBeam2.LightEmission = 1.5 redBeam2.Color = ColorSequence.new(Color3.fromRGB(255, 0, 0)) redBeam2.Texture = "rbxassetid://124670965229302" redBeam2.Attachment0 = redAttachment1 redBeam2.Attachment1 = redAttachment2 redBeam2.Enabled = false redBeam2.Parent = container
-- Create billboard gui for center visual local billboard = Instance.new("BillboardGui") billboard.AlwaysOnTop = true billboard.Size = UDim2.new(1.25, 0, 1.25, 0) billboard.StudsOffset = Vector3.new(0, 3.5, 0) billboard.Adornee = attachment1 -- Use attachment as reference billboard.Parent = container
local outline = Instance.new("Frame") outline.AnchorPoint = Vector2.new(0.5, 0.5) outline.Position = UDim2.new(0.5, 0, 0.5, 0) outline.Size = UDim2.new(1, 4, 1, 4) outline.BackgroundColor3 = Color3.fromRGB(0, 0, 0) outline.BorderSizePixel = 0 outline.Rotation = 45 outline.Parent = billboard
local diamond = Instance.new("Frame") diamond.AnchorPoint = Vector2.new(0.5, 0.5) diamond.Position = UDim2.new(0.5, 0, 0.5, 0) diamond.Size = UDim2.new(1, 0, 1, 0) diamond.BackgroundColor3 = Color3.fromRGB(0, 170, 255) diamond.BackgroundTransparency = 0 diamond.BorderSizePixel = 0 diamond.Rotation = 45 diamond.Parent = billboard
-- Float animation for the attachments local function floatAnimation() local startPos1 = attachment1.Position local startPos2 = attachment2.Position
local tween1 = TweenService:Create(attachment1, TweenInfo.new(FLOAT_DURATION, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, -1, true), {
Position = startPos1 + Vector3.new(0, FLOAT_HEIGHT, 0)
})
local tween2 = TweenService:Create(attachment2, TweenInfo.new(FLOAT_DURATION, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, -1, true), {
Position = startPos2 + Vector3.new(0, FLOAT_HEIGHT, 0)
})
tween1:Play()
tween2:Play()
end
local function flickerBeams(intensity, speed) local flickerTime = 0 local flickerConnection = RunService.Heartbeat:Connect(function(deltaTime) flickerTime = flickerTime + deltaTime * speed local flickerValue = (math.sin(flickerTime * 10) + 1) / 2 * intensity beam1.LightEmission = 0.75 + flickerValue beam2.LightEmission = 0.75 + flickerValue end) return flickerConnection end
local function windUpEffect() redBeam1.Enabled = true redBeam2.Enabled = true
TweenService:Create(diamond, TweenInfo.new(0.5, Enum.EasingStyle.Quad), {
BackgroundColor3 = Color3.fromRGB(255, 0, 0),
Size = UDim2.new(6, 0, 6, 0)
}):Play()
beam1.CurveSize1 = -1.35 * WINDUP_SIZE
beam1.CurveSize0 = 1.35 * WINDUP_SIZE
beam2.CurveSize1 = 1.35 * WINDUP_SIZE
beam2.CurveSize0 = -1.35 * WINDUP_SIZE
attachment1.Position = Vector3.new(0, 0, -1 * WINDUP_SIZE)
attachment2.Position = Vector3.new(0, 0, 1 * WINDUP_SIZE)
beam1.TextureSpeed = WINDUP_TEXTURE_SPEED
beam2.TextureSpeed = -WINDUP_TEXTURE_SPEED
local flickerConnection = flickerBeams(0.5, 10)
local windupTweenInfo = TweenInfo.new(WINDUP_DURATION, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
local beam1Tween = TweenService:Create(beam1, windupTweenInfo, {
CurveSize1 = -1.35 * BASE_SIZE,
CurveSize0 = 1.35 * BASE_SIZE,
TextureSpeed = BASE_TEXTURE_SPEED
})
local beam2Tween = TweenService:Create(beam2, windupTweenInfo, {
CurveSize1 = 1.35 * BASE_SIZE,
CurveSize0 = -1.35 * BASE_SIZE,
TextureSpeed = -BASE_TEXTURE_SPEED
})
local attachment1Tween = TweenService:Create(attachment1, windupTweenInfo, {
Position = Vector3.new(0, 0, -1 * BASE_SIZE)
})
local attachment2Tween = TweenService:Create(attachment2, windupTweenInfo, {
Position = Vector3.new(0, 0, 1 * BASE_SIZE)
})
beam1Tween:Play()
beam2Tween:Play()
attachment1Tween:Play()
attachment2Tween:Play()
task.delay(WINDUP_DURATION * 0.75, function()
flickerConnection:Disconnect()
flickerConnection = flickerBeams(0.2, 5)
end)
task.delay(WINDUP_DURATION, function()
flickerConnection:Disconnect()
beam1.LightEmission = 0.75
beam2.LightEmission = 0.75
redBeam1.Enabled = false
redBeam2.Enabled = false
TweenService:Create(diamond, TweenInfo.new(0.5, Enum.EasingStyle.Quad), {
BackgroundColor3 = Color3.fromRGB(0, 170, 255),
Size = UDim2.new(1, 0, 1, 0)
}):Play()
end)
end
local function shrinkEffect() local tweenInfo = TweenInfo.new(SHRINK_DURATION, Enum.EasingStyle.Quad, Enum.EasingDirection.Out) local currentSize = BASE_SIZE
while currentSize > MIN_SIZE do
local targetSize = math.max(currentSize - 1, MIN_SIZE)
TweenService:Create(beam1, tweenInfo, {CurveSize1 = -1.35 * targetSize}):Play()
TweenService:Create(beam1, tweenInfo, {CurveSize0 = 1.35 * targetSize}):Play()
TweenService:Create(beam2, tweenInfo, {CurveSize1 = 1.35 * targetSize}):Play()
TweenService:Create(beam2, tweenInfo, {CurveSize0 = -1.35 * targetSize}):Play()
TweenService:Create(attachment1, tweenInfo, {Position = Vector3.new(0, 0, -1 * targetSize)}):Play()
TweenService:Create(attachment2, tweenInfo, {Position = Vector3.new(0, -0.25 * targetSize, 1 * targetSize)}):Play()
currentSize = targetSize
task.wait(0.2)
end
end
-- Initialize the effect task.delay(APPEAR_DELAY, function() beam1.Enabled = true beam2.Enabled = true floatAnimation() windUpEffect() task.delay(WINDUP_DURATION, shrinkEffect) end)
make it that if any player is out of the circle size range (by using a new attachment that is the center of the circle) then damage damage quickly. and if the player died once then do not damage them again. if all players have died then destroy it.