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

A GUI for every player on that team when they respawn?

So when you join the game, You are greeted by a choose team GUI. I have all that part sorted out. When You join -Lets say Counter-Terrorists- I want a GUI to come up every time they die. I have the frame and all that stuff ready. its just that the script I did won't work because that was PlayerAdded so when they joined, they would be automatically put into a team. I have changed it, so I need some help on how the script should be so that when a person on a team dies, they get a gui everytime they spawn. Here is the script I currently have. I know it won't work, but can anyone please edit it so that every time they spawn, they get it. I made it myself so I had annotations in it.

game.Players.PlayerAdded:connect(function(p)
    p.CharacterAdded:connect(function(char)
        if p.TeamColor.Name == "Really blue" then -- If you just want Really blue players having it
            p:WaitForChild("PlayerGui")
            game.ServerStorage["CT Class"]:clone().Parent = p.PlayerGui
        end
    end)
end)

So I know this is when player joins, but I need it as when they die it spawns for them every time. IDK why but its not working. There is nothing In the output that would be useful in this question.

Thanks.

2 comments

0

When I said "so when they joined, they would be automatically put into a team.", I was saying that I did this in my old update of my game. But I changed it to an update where you can choose which team you want to be. Later on im going to add a "Balance Team Script" which will try and keep the teams balanced.

0

I found the problem. My Frame Was Invisible but this script helped.

2 answers

✓ Accepted answer

A simple fix is to place the gui into the PlayerGui, every time the CharacterAdded event occurs. This event occurs on player respawn.

game.Players.PlayerAdded:connect(function(p)
    p.CharacterAdded:connect(function(char)
        if p.TeamColor.Name == "Really blue" then -- If you just want Really blue players having it
            p:WaitForChild("PlayerGui")
            game.ServerStorage["CT Class"]:Clone().Parent = p.PlayerGui

	    p.CharacterAdded:Connect(function(character)
	        game.ServerStorage["CT Class"]:Clone().Parent = p.PlayerGui  
	    end)

        end
    end)
end)

Clone has to be UpperCase

game:GetService("Players").PlayerAdded:connect(function(p)
    p.CharacterAdded:connect(function(char)
        if p.TeamColor.Name == "Really blue" then -- If you just want Really blue players having it
            game.ServerStorage["CT Class"]:Clone().Parent = p.PlayerGui
        end
    end)
end)

2 comments

0

if that doesn't work post any errors.

0

Clone still works as lower case.

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