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

GUI not working? part 2

Asked by 8 years ago

Here is part 2 of 2, so when I made this GUI it was supposed to fill when I killed an enemy, but it didn't and when I tried one of the moves out (after manually adding the amount through the script) the moves wouldn't work either. So here is the script:

VINT=Tool.Parent.Torso.CFrame.lookVector
        ST=Tool.Handle.CFrame.p
        for i=1, 15 do
        e=Instance.new("Part")
        e.TopSurface=0
        e.BottomSurface=0
        e.CanCollide=false
        e.Anchored=true
        e.Shape="Ball"
        e.Size=Vector3.new(1,1,1)
        e.CFrame=CFrame.new(ST+(VINT*(i*5))+Vector3.new(math.random(-1,1),-1,math.random(-1,1)))*CFrame.fromEulerAnglesXYZ(0,0,0)
        e.Name="Effect"
        e.BrickColor=Tool.Parent.Torso.BrickColor
        e.Parent=workspace
        m=script.Parent.BlastMesh:clone()
        m.Parent=e
        coroutine.resume(coroutine.create(function(m) for i=1, 10 do m.Parent.CFrame=m.Parent.CFrame*CFrame.new(0,0.1,0) m.Scale=m.Scale+Vector3.new(.5,1-i*.175,.5) m.Parent.Transparency=i/100 wait() end m.Parent.Parent=nil end),e.BlastMesh)
        Pos=e.Position
        m=Tool.Handle.MS:clone()
        m.Parent=e
        m:Play()
        for _,d in pairs(workspace.Enemies:children()) do
            if d.className=="Model" then
                t=d:FindFirstChild("Torso")
                h=d:FindFirstChild("Humanoid")
                if t~=nil and h~=nil then
                    if h.Health>0 and (t.Position-(Pos-Vector3.new(0,0,0))).magnitude<=6.5 then
                        if d~=Tool.Parent and game.Players:GetPlayerFromCharacter(d)==nil and d:FindFirstChild("DD")==nil then
                            v=Instance.new("BodyVelocity")
                            v.P=5000
                            v.maxForce=Vector3.new(math.huge,math.huge,math.huge)
                            v.velocity=Vector3.new(0,5*i,0)+(t.Position-Pos).unit*2+VINT*45
                            v.Parent=t
                            h:TakeDamage(20)
                            game:GetService("Debris"):AddItem(v,.25)
                            v=Instance.new("Sound")
                            v.Volume=.5
                            v.Pitch=2.5
                            v.Parent=t
                            v.SoundId="http://roblox.com/asset/?id=10209821"
                            v:Play()
                            game:GetService("Debris"):AddItem(v,5)
                            v=Instance.new("BodyAngularVelocity")
                            v.P=5000
                            v.maxTorque=Vector3.new(60000,60000,60000)*60000
                            v.angularvelocity=Vector3.new(math.random(-10,10),20,math.random(-10,10))+(t.Position-Pos).unit*20
                            v.Parent=t
                            game:GetService("Debris"):AddItem(v,.5)
                            ShowDamage(d,20,.5)
                        end
                    end
                end
            end
        end
        wait(.1)
        end
        wait(.5)
        Tool.Handle.Slash.Pitch=.6
        contip1:disconnect()
        FakeS.MaxVelocity=.15
        FakeS.DesiredAngle=1.6
        Reset(FakeS)
        Tool.Handle.Slash.Pitch=1
end
sp=true
vKey=function(k)
    if sp==false then return end
    sp=false
    print("!")
    vPlayer=game.Players.LocalPlayer
    if k=="z" then
        if Rage<40 then
            sp=true
            return
        end
        print("SPINSLASH")
        SpinSpec()
        Rage=Rage-40
        wait(3)
    elseif k=="x" then
        if Rage<55 or vPlayer:FindFirstChild("Shockwave")==nil then
            sp=true
            return
        end
        Rage=Rage-55
        MegaSmash()
    elseif k=="c" then
    end
    sp=true
end
SlashAnim=function(Weld,TypeS,EndCMD,TimeW)
    if TypeS==1 then
        Type="Slash"
        Origin=CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
        StartC0=CFrame.new(0.75, -2.18556941e-008, -1, 0, -0.866025388, -0.5, 0, -0.5, 0.866025388, -1, 0, 0)
        Anim=Weld
        Anim.C0=StartC0
        Anim.MaxVelocity=0
        Anim.C1=Anim.C1*CFrame.new(0,1,0)
        Anim.CurrentAngle=2.8
        Tool.Handle.Slash:Play()
        Tool.Handle.Slash.Pitch=.5
        Anim.MaxVelocity=.5
        Anim.DesiredAngle=-.7
        conmain=Tool.Handle.Touched:connect(function(hit) Damage(hit,3) end)
        vpv=Instance.new("BodyVelocity")
        vpv.P=2000
        vpv.maxForce=Vector3.new(math.huge,0,math.huge)
        vpv.Parent=Blade
        vpv.velocity=CPlayer.Torso.CFrame.lookVector*8
        game:GetService("Debris"):AddItem(vpv,.2)
        for i=1, 4 do
            wait(.05)
            Anim.C0=Anim.C0*CFrame.new(-.175,-0.1,.05)
        end
        wait(.1)
        Anim.C1=Anim.C1*CFrame.new(0,-1,0)
        Anim.C0=Origin
        Tool.Handle.Slash.Pitch=.6
        wait(.1)
    elseif TypeS==2 then
Weld.DesiredAngle=3.6
        Weld.MaxVelocity=.7
        wait(.07)
        Tool.Handle.Slash:Play()
        wait(.07)
        Weld.MaxVelocity=.6
        Type="PowerfulSlash"
        conmain=Tool["Handle"].Touched:connect(function(hit) Damage(hit,0) end)
        Weld.DesiredAngle=-.1
        wait(.15)
        Weld.DesiredAngle=1.6
        wait(.15)
    elseif TypeS==3 then
Tool.Handle.Slash:Play()
        Tool.Handle.Slash.Pitch=.85
        Weld.C0=Weld.C0*CFrame.fromEulerAnglesXYZ(-math.pi/2,0,0)+Vector3.new(.25,-.5,0)
        Weld.MaxVelocity=.4
        Weld.CurrentAngle=1.6
        Weld.DesiredAngle=-.4
        Type="Slash"
        conmain=Tool["Handle"].Touched:connect(function(hit) Damage(hit,0) end)
        wait(.3)
        Tool.Handle.Slash.Pitch=.6
        Weld.C0=RightS.C0
    end
    if EndCMD=="Reset" then
        Reset(Weld)
    elseif EndCMD=="ResetandWait" then
        Reset(Weld)
        wait(TimeW)
    end
    conmain:disconnect()
end 
Swing=function()
    if CPlayer==nil then
        return
    end
    Torso=CPlayer:FindFirstChild("Torso")
    if Torso==nil then
        return
    end
    if not Deb then return end
        Deb=false
    Sh=Torso["Right Shoulder"]
    if Type=="Slash" and Timing(.2)==false then
        SlashAnim(Sh,1,"Nothing")
        if Type~="PowerfulSlash" then   
        wait(.2)
            Reset(Sh)
        end
        Time=time()
    elseif Type=="Slash" and Timing(.4)==true then
        SlashAnim(Sh,2,"Reset")
        Time=time()
        coroutine.resume(coroutine.create(function() while true do if Timing(.4)==false then break end wait() end Type="Slash" end))
    elseif Type=="PowerfulSlash" and Timing(.4)==true then
        SlashAnim(Sh,3,"Reset")
        Time=time()
        while true do
            if Timing(.2)==false then
                break
            end
            wait()
        end
        Type="Slash"
    end
    Deb=true
end
EquipDebounce=true
onEquipped=function(mouse)
    if not EquipDebounce then
        return
    end
    EquipDebounce=false
    CPlayer=Tool.Parent
    coroutine.resume(coroutine.create(Animation),CPlayer["Torso"],"Stop")
    wait()
    jCon=CPlayer.Humanoid.Jumping:connect(function() JumpCon(FakeS) end)
    print(".")
    print(lol)
end
EqLocal=function(mouse)
    lol=mouse.KeyDown:connect(function(l) print("KK") vKey(l) end)
    mouse.Button1Down:connect(Swing)
end
onPutAway=function()
    if CPlayer==nil then
        return
    end
    EquipDebounce=true
    Animation(CPlayer["Torso"],"Resume")
    jCon:disconnect()
end
Tool.Unequipped:connect(onPutAway)
Tool.Equipped:connect(onEquipped)
Tool.Equipped:connect(EqLocal)
CCRage=function(M,c)
    for ___,mmmm in pairs(M) do
        if c==mmmm then
            return false
        end
    end
    return true
end
HandlePB=function(BAR)
    Added={}
    while true do
        Div=Rage/MaxRage
        if Rage<10 then
            Rag=string.sub(Rage,1,3)
        else
            Rag=string.sub(Rage,1,4)
        end
        BAR.PressureBar.RageBar.Fill.Size=UDim2.new(Div,0,.9,0)
        BAR.PressureBar.RageBar.Label.Text="Rage("..tostring(Rag)..")"
        for _,v in pairs(vPlayer:children()) do
            if v.Name=="RageUp" then
                if CCRage(Added,v)==true then
                    table.insert(Added,v)
                    MaxRage=MaxRage+v.Value
                    print("MORE RAGE.")
                end
            end
        end
        wait()
    end
end
SetupGUI=function()
    BarGUI=vPlayer.PlayerGui:FindFirstChild("RageGUI")
    if BarGUI==nil then
        BarGUI=script.RageGUI:clone()
        BarGUI.Parent=vPlayer.PlayerGui
    end
    coroutine.resume(coroutine.create(HandlePB),BarGUI)
end
wait(5)
while true do
    vPlayer=game.Players.LocalPlayer
    if vPlayer~=nil then
        if vPlayer.Character~=nil then
            SetupGUI()
            break
        end
    end
    wait(.1)
end

Thanks if you read this and double thanks if you reply it starts at line 202 and ends at line 468. Btw this was an edited question since I didn't want to ask a new one. Thanks

1 answer

Log in to vote
0
Answered by 8 years ago
function onPlayerRespawned(player)

        wait(5)

        player.Character.Humanoid.Health = player.leaderstats.Level * 100

        player.Character.Humanoid.MaxHealth = player.leaderstats.Level * 100

First of all, this looks like a free model... Secondly, I don't see anywhere in the script where you have even tried to change the health, at least try and script it. This is not a request site. Third, this is what?? This changes the health when the player respawns?? what?

How to do this


player.Character.Humanoid.MaxHealth = player.Character.Humanoid.MaxHealth +50 player.Character.Humanoid.Health = player.Character.Humanoid.Health +50

Always change the MaxHealth before you try to exceed the overall maxhp.

Hope this helps.

0
I'm offended you would think this is a free model, it was scripted entirely by me for my game, I do appreciate the information you have given me though STICKYBUN10 19 — 8y
0
I tried it and it worked so thanks anyway STICKYBUN10 19 — 8y
0
I didn't mean to offend you but, it never looked like you tried.. And it didn't look like you knew what you were doing as you posted a ton of code not needed. Also "fireworks" are old school, I suggest using the particle system. Anyway, accept my answer if this has answered your question. legoguy939 418 — 8y
Ad

Answer this question