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

How would I make the ice do damage in the script?

Asked by
Qiuor 20
8 years ago
plar = game.Players.LocalPlayer
Mouse = plar:GetMouse()
char = plar.Character
charge = 0
function press(key)
    if charge >= 2 then return
        end
    key = key:lower() 
    if key == "t" then
        charge = charge + 1
        local I = Instance.new("Part")
        I.Material = "Ice"
        I.BrickColor = BrickColor.new("Medium blue")
        I.BottomSurface = "Smooth"
        I.TopSurface = "Smooth"
        I.Shape = "Cylinder"
        I.Size = Vector3.new(25, 1, 2)
        I.Transparency = .4
        I.CFrame = char.Torso.CFrame * CFrame.new(0, 0, -5)
        I.Parent = workspace
        local spin = true
        local BV = Instance.new("BodyVelocity")
        BV.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
        BV.Velocity = char.Torso.CFrame.lookVector * 40
        BV.Parent = I
        for c = 1,90 do
            I.CFrame = I.CFrame * CFrame.fromEulerAnglesXYZ(0, .3, 0)
            wait(.03)
            end
        I:Remove()
        charge = 0
        end
end
Mouse.KeyDown:connect(press)

How would I get the script to deal damage to those who hit the ice.

1 answer

Log in to vote
1
Answered by 8 years ago
Edited 8 years ago

Include

amt = 25 -- Set amount
local humanoid = plar.Parent:FindFirstChild("Humanoid") 
if (humanoid ~= nil) then   -- if a humanoid exists, then
        humanoid.Health = humanoid.Health - amt -- Using amt variable
end

Somewhere in your script.

0
I think I got the humanoid variable wrong. TheUniPiggy 77 — 8y
Ad

Answer this question