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

Skill only damages in Test mode?

Asked by
soutpansa 120
7 years ago

This script makes it so that an animation plays then an expanding yellow ball is placed at the end of the user's arm when they press z. There's a script called FireDamage inside of this script, that tells the yellow ball to make the player hit sit, and take a certain amount of damage. It works, but only in test mode.

Any idea what's wrong?

Yellow Ball script:

local Player = game.Players.LocalPlayer 
local mouse = Player:GetMouse() 
local lastUse = 0;
local char = Player.Character or Player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
Player.CharacterAdded:connect(function(character)
        char = character
    hum = char:WaitForChild("Humanoid")
end)
if not hum.Parent then
    repeat wait(0.2) until hum.Parent
end


local function onKeyDown(key) 
    local Key = key:lower()
    if key == "z" and tick()-lastUse > 10 then



        lastUse = tick();  
        local x = Instance.new("Part")
        x.BrickColor = BrickColor.new("Bright yellow")
        x.Material = "Neon"
        x.CanCollide = false
        x.Transparency = 0.4
        x.Size = Vector3.new(10,10,10)
        x.TopSurface = "Smooth"
        x.BottomSurface = "Smooth"
        x.Shape = "Ball"
        x.Name = Player.Name
        x.Anchored = true
        local fd = script.fireDamage:clone()
        fd.Parent = x
        local Mesh = Instance.new("SpecialMesh")
        Mesh.MeshType = "Sphere"
        Mesh.Scale = Vector3.new(1,1,1)
        Mesh.Parent = x
      --[[  local a = Instance.new("Sound")
        a.SoundId = "http://www.roblox.com/asset/?id=260430117"
        a.Parent = x
        a.Volume = 2
        a:play()]]

           local animTrack = hum:LoadAnimation(script.Punch)
            animTrack:Play()
            wait(1)
            animTrack:Stop()













        x.CFrame = Player.Character.Torso.CFrame*CFrame.new(2, 1 , -4)
        x.Parent = workspace 

        for explode = 1,30 do
        Mesh.Scale = Mesh.Scale + Vector3.new(0.09,0.09,0.09)
        x.Transparency = x.Transparency + 0.03
        wait(0.001)
        end

        game.Debris:AddItem(x, 0.03)


    end
end





mouse.KeyDown:connect(onKeyDown)

Fire Damage:

function onDamage(Part)
    if Part.Parent:FindFirstChild("Humanoid") ~= nil and Part.Parent.Name ~= script.Parent.Name and Part.Parent:FindFirstChild("ForceField") == nil  then



            Part.Parent.Humanoid.Health = Part.Parent.Humanoid.Health - script.Damage.Value
            Part.Parent.Humanoid.Sit = true

        end
        end




script.Parent.Touched:connect(onDamage)
0
Is Filtering Enabled on? farrizbb 465 — 7y
0
No, FE is not enabled soutpansa 120 — 7y

Answer this question