Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make this script do damage to a enemy being hitten by the explosion?

Asked by 4 years ago
Edited 4 years ago

this code simply makes a part clone and then do simple dash with an explosion of air.... but I also want this code to do harm to any enemy

inside the localscript there two meshes GepPart(Initial explosion) and Ice(Explosion) Sorry if i'm not clear at explaning this....

Script

Player = game.Players.LocalPlayer
Power = false
mouse = Player:GetMouse()
local plr = game.Players.LocalPlayer
local Char= plr.Character or plr.CharacterAdded:Wait()
local TweenService = game:GetService("TweenService")
if mouse then
mouse.KeyDown:connect(function(key)
if key=="x"  and Power == false  then   

    local createEffects = coroutine.wrap(function()
        local controls = require(game:GetService("Players").LocalPlayer.PlayerScripts.PlayerModule):GetControls()
controls:Disable()

local hum = script.Parent:WaitForChild("Humanoid")
local anim = hum:LoadAnimation(script:FindFirstChildOfClass("Animation"))
anim.Looped = false
anim:Play()
                local Part = script.GepPart:Clone()
                Part.Parent = workspace
                Part.Anchored = true
                Part.CanCollide = false
                Part.CFrame = Player.Character:FindFirstChild("HumanoidRootPart").CFrame * CFrame.new(0,-2.22,0)
                local TI = TweenInfo.new(
                    1,
                    Enum.EasingStyle.Linear,
                    Enum.EasingDirection.Out
                )
                local Propertys = {
                    Size = Vector3.new(Part.Size.X+10,Part.Size.Y+2,Part.Size.Y+10);
                    Transparency = 1;
                }
                TweenService:Create(Part,TI,Propertys):Play()
                return Part,true
            end)
            createEffects()

            wait(1.30)
                        local animation = script:WaitForChild('Animation1')
local humanoid = script.Parent:WaitForChild('Humanoid')
local dance = humanoid:LoadAnimation(animation)
wait(2)
dance:Play()
            wait(1)

              Char.HumanoidRootPart.Velocity = Char.HumanoidRootPart.CFrame.lookVector*500
                            local Part1 = script.Ice:Clone()
                Part1.Parent = workspace
                Part1.Anchored = true
                Part1.CanCollide = false
                Part1.CFrame = Player.Character:FindFirstChild("HumanoidRootPart").CFrame * CFrame.new(0,-2.22,0)
                local TI = TweenInfo.new(
                    1,
                    Enum.EasingStyle.Linear,
                    Enum.EasingDirection.Out
                )
                local Propertys = {
                    Size = Vector3.new(Part1.Size.X+10,Part1.Size.Y+2,Part1.Size.Y+10);
                    Transparency = 1;
                }
                TweenService:Create(Part1,TI,Propertys):Play()
                return Part1,true
            end

            wait(2) 

            local controls = require(game:GetService("Players").LocalPlayer.PlayerScripts.PlayerModule):GetControls()
controls:Enable()
end)
end
0
magnitude speedyfox66 237 — 4y
0
how do i use magnitude in this script? can you give me explanation? Gabry20 0 — 4y

Answer this question