I want my ability to do damage but I don’t know how to do that. I want it so that when a player that’s not the player that started the ability touches the SphereClone then they take damage.
Code:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local AttackFolder = ReplicatedStorage:WaitForChild("Attacks")
local Sphere = AttackFolder:WaitForChild("Sphere")
local OuterSphere = AttackFolder:WaitForChild("OuterSphere")
local Wave = AttackFolder:WaitForChild("Wave")
-- Tween Info --
local TInfo1 = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)
local TInfo2 = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)
script.Parent:WaitForChild("RemoteEvent").OnServerEvent:Connect(function(player)
local Humanoid = player.Character.Humanoid
local HumanoidRP = player.Character.HumanoidRootPart
local SphereClone = Sphere:Clone()
local OuterSphereClone = OuterSphere:Clone()
local WaveClone = Wave:Clone()
-- Tweens --
local Sphere1Tween = TweenService:Create(SphereClone, TInfo1, {Transparency = 0, Size = Vector3.new(30,30,30)})
local OuterSphere1Tween = TweenService:Create(OuterSphereClone, TInfo1, {Transparency = 0, Size = Vector3.new(32, 32, 32), Orientation = Vector3.new(0, 5000,0)})
local Wave1Tween = TweenService:Create(WaveClone, TInfo1, {Transparency = 0, Size = Vector3.new(42.715, 5, 47.272), Orientation = Vector3.new(0, 5000,0)})
local Sphere2Tween = TweenService:Create(SphereClone, TInfo2, {Transparency = 1, Size = Vector3.new(100,100,100)})
local OuterSphere2Tween = TweenService:Create(OuterSphereClone, TInfo2, {Transparency = 1, Size = Vector3.new(100, 100, 100)})
local Wave2Tween = TweenService:Create(WaveClone, TInfo2, {Transparency = 1, Size = Vector3.new(100, 100, 100)})
-- Clone Properties --
SphereClone.Parent = workspace
OuterSphereClone.Parent = workspace
WaveClone.Parent = workspace
SphereClone.Position = HumanoidRP.Position
OuterSphereClone.Position = HumanoidRP.Position
WaveClone.Position = HumanoidRP.Position
SphereClone.Position = Vector3.new(SphereClone.Position.X, SphereClone.Position.Y/2, SphereClone.Position.Z)
OuterSphereClone.Position = Vector3.new(OuterSphereClone.Position.X, OuterSphereClone.Position.Y/2, OuterSphereClone.Position.Z)
WaveClone.Position = Vector3.new(WaveClone.Position.X, WaveClone.Position.Y/2, WaveClone.Position.Z)
Sphere1Tween:Play()
OuterSphere1Tween:Play()
Wave1Tween:Play()
wait(1)
Sphere2Tween:Play()
OuterSphere2Tween:Play()
Wave2Tween:Play()
wait(1)
SphereClone:Destroy()
OuterSphereClone:Destroy()
WaveClone:Destroy()
end)