#why is my message NOT removing after i die?

1 messages · Page 1 of 1 (latest)

tribal heron
#

repeat wait() until #game.Players:GetPlayers() > 0
function message(text)
local msg = Instance.new("Message", game.StarterGui)
msg.Name = "GameMessage"
msg.Text = text
wait(3)
msg:Destroy()
end
function endmessage()
local randomplr = game.Players:GetChildren()[math.random(1,#game.Players:GetChildren())]
randomplr.Character.Humanoid.Health = 0
for i,v in game.Players:GetChildren() do
print(v)
local gun = game.Lighting.Pistol:Clone()
local flashlight = game.Lighting.Flashlight:Clone()
flashlight.Parent = v.Backpack
gun.Parent = v.Backpack
end
end
message("Humans, defend yourselves towards the zombies.")
wait(3)
endmessage()
if game.StarterGui:WaitForChild("GameMessage") ~= nil then
game.StarterGui:WaitForChild("GameMessage"):Destroy()
end

empty ferry
#

it is only the message that is the issue?

tribal heron
#

when you die

#

it does not remove

#

they told me it was deprecated

empty ferry
#

like is the items are given?

tribal heron
#

the item are given.

empty ferry
#

hmm

#

im trying to figure it out

cerulean osprey
#

@tribal heron

#

Try this

#

function showMessage(text)
for _, player in pairs(game.Players:GetPlayers()) do
local gui = Instance.new("ScreenGui")
gui.Name = "GameMessageGui"
gui.ResetOnSpawn = true
gui.Parent = player:WaitForChild("PlayerGui")

    local label = Instance.new("TextLabel")
    label.Size = UDim2.new(1, 0, 0.1, 0)
    label.Position = UDim2.new(0, 0, 0, 0)
    label.BackgroundTransparency = 0.5
    label.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
    label.TextColor3 = Color3.fromRGB(255, 255, 255)
    label.Font = Enum.Font.SourceSansBold
    label.TextSize = 32
    label.Text = text
    label.Parent = gui

    task.delay(3, function()
        if gui then
            gui:Destroy()
        end
    end)
end

end

tribal heron
#

ok.

cerulean osprey
#

Lmk if it didn’t work

empty ferry
#

dayum hes creating a brand new textlabel

tribal heron
#

i actually used an textlabel too

#

but i guess it didnt work

#

also ty for the free "hint"

cerulean osprey
#

Fixed?

tribal heron
#

imma use it as a hint

#

yes

cerulean osprey
#

Alr

tribal heron
#

tym

cerulean osprey
#

Lmk if you have any questions

tribal heron
#

tysm

tribal heron
cerulean osprey
#

Hi

tribal heron
#

after that

#

why does like the uh

#

script error this function?

#

what

cerulean osprey
#

Show

tribal heron
#

when its deathteam

#

it errors that it fails to "index" or whatever it says

cerulean osprey
#

I’ll take a look

tribal heron
cerulean osprey
#

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local showMessageRemote = ReplicatedStorage:WaitForChild("ShowMessage")

showMessageRemote.OnClientEvent:Connect(function(text)
local existingGui = player:FindFirstChild("PlayerGui"):FindFirstChild("GameMessageGui")
if existingGui then
existingGui:Destroy()
end

local gui = Instance.new("ScreenGui")
gui.Name = "GameMessageGui"
gui.ResetOnSpawn = true
gui.Parent = player:WaitForChild("PlayerGui")

local label = Instance.new("TextLabel")
label.Size = UDim2.new(1, 0, 0.08, 0)
label.Position = UDim2.new(0, 0, 0.02, 0)
label.BackgroundTransparency = 0.3
label.BackgroundColor3 = Color3.new(0, 0, 0)
label.TextColor3 = Color3.new(1, 1, 1)
label.Font = Enum.Font.GothamBold
label.TextScaled = true
label.Text = text
label.Parent = gui

task.delay(3, function()
    for i = 1, 10 do
        label.TextTransparency = i * 0.1
        label.BackgroundTransparency = 0.3 + (i * 0.07)
        task.wait(0.05)
    end
    gui:Destroy()
end)

end)

tame gateBOT
#

studio** You are now Level 2! **studio

tribal heron
tribal heron
#

that is not what i requested

cerulean osprey
#

The new script

tribal heron
#

but ill take it

cerulean osprey
#

U weren’t specific

#

But ok

tribal heron
#

the function "teamdeath" changed the team of a player upon its death.

#

and there was an function that detected if a team of player number equals 0.

cerulean osprey
#

You want me to fix it?

tribal heron
#

i just need scripting help

tribal heron
cerulean osprey
#

Alrighty