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

Title only shows up once and doesn't show up if the player dies/reloads! Any help?

Asked by 6 years ago
Edited 6 years ago

Title explains it all

Scroll to Line 32 - the end

game.Players.PlayerAdded:Connect(function(plr)
    wait(0.5)
    local titles = Instance.new("Folder", plr)
    titles.Name = "Data"
    local titlef = Instance.new("StringValue", titles)
    titlef.Name = "Title"
    local function res()
        titlef.Changed:Connect(function()
        print("Changed: "..titlef.Value)
        if titlef.Value ~= "" then
            local rep = game.ReplicatedStorage.Shop.Titles[titlef.Value]
            local color = rep.ColorValue
            local char = plr.Character
            local head = char.Head
            if not head:FindFirstChildOfClass("BillboardGui") then
                print("Haha")
                local bb = game.ServerStorage.BillboardGui
                local sd = bb:Clone()
                local tx = sd.TextLabel
                sd.Parent = plr.Character.Head
                tx.BackgroundTransparency = 1 
                tx.TextColor3 = color.Value
                sd.AlwaysOnTop = true
                sd.StudsOffset = Vector3.new(0, 2, 0)
                tx.Text = titlef.Value
            end
        end
    end)
end     
    res()
    -- Below doesn't work!
    plr.Character.Humanoid.Died:Connect(function()
        wait(6)
        res()
    end)
end)
1
As MineBlow said below, you shouldn't be using Died. Because when the player respawns, the tag goes away. You want to have the tag AFTER the player respawns. chexburger 358 — 6y
0
I'm pretty sure it's because PlayerAdded only runs once... mudathir2007 157 — 6y

1 answer

Log in to vote
2
Answered by 6 years ago
Edited 6 years ago

You shouldn't use Died at this situation.

For me, I think you should use CharacterAdded.

It's like when the player respawned. It's alot better than you just do Died then wait(6).

So yeah, I hope this helped.

Example:

plr.CharacterAdded:Connect(function(ch)
    res()
end) -- :P
0
Okay, I know I'm late but, I'll try mudathir2007 157 — 6y
0
It still doesn't work, title doesn't show up. I'll just leave an upvote for the suggestion so I will use CharacterAdded. Thanks anyway. mudathir2007 157 — 6y
Ad

Answer this question