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

How would I go about making a gui appear when a player kills an npc?

Asked by 7 years ago

When a player kills an npc I want to make it so that a gui would appear showing how much XP the player has earned.. If you guys could help me figure out just how to make a gui appear I could do the rest with the XP and such.

here's what I tried

local Humanoid = script.Parent.Enemy 
function PwntX_X() 
local tag = Humanoid:findFirstChild("creator")
    if tag ~= nil then 
        if tag.Value ~= nil then 
local Leaderstats = tag.Value:findFirstChild("leaderstats") 
            if Leaderstats ~= nil then 
Leaderstats.XP.Value = Leaderstats.XP.Value + 3
    game.startergui.xp.Frame.visible=true
    wait(1)
    game.startergui.xp.Frame.visible=false  
wait(0.1)
script:remove()
            end 
        end 
    end 
end 
Humanoid.Died:connect(PwntX_X) 
0
Capitalise StarterGui, but instead of that, you might want to use PlayerGui because StarterGui just stores and clones it's children into PlayerGui. awfulszn 394 — 7y
0
Are you getting any errors/ AstrealDev 728 — 7y

Answer this question