How do I make the ability do dmg per second?
Asked by
5 years ago Edited 5 years ago
I need to make it to where the ability does 3 dmg per second when a player a touching it
02 | local tween = game:GetService( "TweenService" ) |
05 | script.Parent.RemoteEvent.OnServerEvent:Connect( function (player) |
06 | if casting = = true then return end |
09 | local iceSpikes = game.ReplicatedStorage.LightCage:Clone() |
12 | iceSpikes:SetPrimaryPartCFrame(player.Character.HumanoidRootPart.CFrame) |
13 | iceSpikes.Parent = workspace |
14 | local endPositions = { Position = { } , Orientation = { } } |
15 | for i,v in pairs (iceSpikes.Spikes:GetChildren()) do |
16 | endPositions [ "Position" ] [ i ] = v.Position |
17 | endPositions [ "Orientation" ] [ i ] = v.Orientation |
18 | v.CFrame = CFrame.new(iceSpikes.Center.Position) |
23 | local Sound = script.Parent.Lightning |
25 | for i,v in pairs (iceSpikes.Spikes:GetChildren()) do |
26 | v.Orientation = endPositions [ "Orientation" ] [ i ] |
27 | tween:Create(v, TweenInfo.new( 0 ), { Position = endPositions [ "Position" ] [ i ] } ):Play() |
31 | for i,v in pairs (iceSpikes.Spikes:GetChildren()) do |
32 | v.Touched:Connect( function (hit) |
33 | if hit.Parent:FindFirstChild( "Humanoid" ) and not hit:IsDescendantOf(player.Character) then |
34 | local enemyHumanoid = hit.Parent:FindFirstChild( "Humanoid" ) |
35 | enemyHumanoid:TakeDamage(dmg) |
46 | if iceSpikes.Parent = = workspace then |