Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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)

2 comments

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.

0

I'm pretty sure it's because PlayerAdded only runs once...

1 answer

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

2 comments

0

Okay, I know I'm late but, I'll try

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.