Simple wave system not working

local Wave1 = workspace.Wave1
local TweenService = game:GetService(“TweenService”)
local NewPosition = Vector3.new(455.19, 85.11, -529.786)
local TweenInfo = TweenInfo.new(
5,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local Tween = TweenService:Create(Wave1,TweenInfo, {Position = NewPosition})
Tween:Play()

Wave1.Touched:Connect(function(touching)
local humanoid = touching.Parent:FindFirstChild(“Humanoid”)
if humanoid then
humanoid.Health = 0
end
end)

local Wave = workspace.Wave
local TweenService = game:GetService(“TweenService”)
local NewPosition = Vector3.new(455.19, 85.11, -529.786)
local TweenInfo = TweenInfo.new(
27,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local Tween = TweenService:Create(Wave,TweenInfo, {Position = NewPosition})
Tween:Play()

Wave.Touched:Connect(function(touched)
local humanoid = touched.Parent:FindFirstChild(“Humanoid”)
if humanoid then
humanoid.Health = 0
end
end)

Only 1 wave is working

1 Like

Probably You are spawning Both in 1 TweenInfo
also both use
image
So i think there are so many things wrong

Try This:

local Wave1 = workspace.Wave1
local TweenService = game:GetService("TweenService")
local NewPosition1 = Vector3.new(455.19, 85.11, -529.786)
local TweenInfo1 = TweenInfo.new(
    5,
    Enum.EasingStyle.Linear,
    Enum.EasingDirection.Out,
    0,
    false,
    0
)
local Tween1 = TweenService:Create(Wave1, TweenInfo1, {Position = NewPosition1})
Tween1:Play()

Wave1.Touched:Connect(function(touching)
    local humanoid = touching.Parent:FindFirstChild("Humanoid")
    if humanoid then
        humanoid.Health = 0
    end
end)

local Wave2 = workspace.Wave -- Use a different variable name for the second wave
local NewPosition2 = Vector3.new(455.19, 85.11, -529.786)
local TweenInfo2 = TweenInfo.new(
    27,
    Enum.EasingStyle.Linear,
    Enum.EasingDirection.Out,
    0,
    false,
    0
)
local Tween2 = TweenService:Create(Wave2, TweenInfo2, {Position = NewPosition2})
Tween2:Play()

Wave2.Touched:Connect(function(touched)
    local humanoid = touched.Parent:FindFirstChild("Humanoid")
    if humanoid then
        humanoid.Health = 0
    end
end)

Also you can Use this for greater input in devforum:
image
image

Great! Thank you was thinking that may of been the problem!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.