I was making a Player Joined/Left notification and it only shows for the one player anyone know why?
β sent the wrong code
I was making a Player Joined/Left notification and it only shows for the one player anyone know why?
β sent the wrong code
can you put your code in code blocks so itβs easier to read?
β code here
Yes I can
local LocalPlayer = Players.LocalPlayer
local char = LocalPlayer.Character
local humanoid = char:WaitForChild("Humanoid")
local Chat = LocalPlayer.PlayerGui:WaitForChild("Chat")
local BubbleChat = LocalPlayer.PlayerGui:WaitForChild("BubbleChat")
local MainUI = LocalPlayer:WaitForChild("PlayerGui").MainGUI
local HealthUI = MainUI.Frame.Stats.HealthFrame.ImageLabel.Health
local DeathMessages = require(game.ReplicatedStorage.DeathMessages)
humanoid.HealthChanged:connect(function(health)
HealthUI.Text = tostring(math.floor(health + 0.5))
end)
humanoid.Died:Connect(function()
local DeathGUI = LocalPlayer:WaitForChild("PlayerGui").DeathGui
local cd = game.Players.RespawnTime+1
for i, v in pairs(LocalPlayer.PlayerGui:GetChildren()) do
if v ~= Chat and v ~= DeathGUI and v ~= BubbleChat then
v:Destroy()
end
end
DeathMessages.Random()
DeathGUI.BackgroundFrame.Visible = true
while cd ~= 0 do
cd = cd-1
DeathGUI.BackgroundFrame.Timer.Time.Text = cd
wait(1)
end
DeathGUI.BackgroundFrame.Visible = false
end)```
this code is different from the code before. which one do you need help with?
Oops I uploaded the wrong code, the one I just sent is the correct, so as I was saying it only shows for the first person who joined the server. Any other person who joined after wont see it.
The best way to approach this is if a player dies fire a remote event to all clients to enable the Gui. The way you are doing it, you could possibly loop through all the players and enable each DeathGui.
Humanoid.Died:Connect(function()
for _, player in pairs(game:GetService("Player"):GetPlayers()) do
player.DeathGUI.Enabled = true -- You can do whatever you need here
end
end)
If the one you just sent is the right one, why is this script checking when the humanoid takes damage and if it died if you need help with joined/leaving notifications?
No I accidentally sent the wrong script I do not need help with the notification one.