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

I want to make it so my deathGui doesnt show up when you score. How? (check bottom for more info)

Asked by 1 year ago

this script checks if a player is on red team when they touch a block then if that person is, the person gets one point. Then once that happens it makes a frame show up and kills all players. But I have a Gui that pops up when you die, I would like to make it so when it kills you after you score. The DeathGui doesnt show up. i tried to do that with this : player:WaitForChild("PlayerGui"):WaitForChild("DeathGui").Enabled = not visible. But it does not work, Can anybody tell me why this is happening thank you. (By the way the code is on line 20)

01local Players = game:GetService("Players")
02local Teams = game:GetService("Teams")
03 
04local function killEveryPlayer()
05    for _, player in ipairs(Players:GetPlayers()) do
06        task.spawn(function()
07            local character = player.Character
08            if (not character) or (not character.Parent) then
09                character = player.CharacterAdded:Wait()
10            end
11            character:FindFirstChildOfClass("Humanoid").Health = 0
12        end)
13    end
14end
15 
View all 39 lines...

1 answer

Log in to vote
0
Answered by 1 year ago
Edited 1 year ago

Okay I fixed my answer. Put line 20 after line 11 or just paste this code:

01local Players = game:GetService("Players")
02local Teams = game:GetService("Teams")
03 
04local function killEveryPlayer()
05for _, player in ipairs(Players:GetPlayers()) do
06        task.spawn(function()
07            local character = player.Character
08            if (not character) or (not character.Parent) then
09                character = player.CharacterAdded:Wait()
10            end
11            local humanoid = character:FindFirstChildOfClass("Humanoid")
12            humanoid.Health = 0
13            humanoid.Died:Wait()
14            player:WaitForChild("PlayerGui"):WaitForChild("DeathGui").Enabled = false
15            task.wait(2.5)
View all 43 lines...
0
Does not work. It puts a red line under visible next to not (Line 12) MariamOMG090 9 — 1y
0
Oh right, sorry -_-‘ T3_MasterGamer 2189 — 1y
0
I fixed it for the last time. T3_MasterGamer 2189 — 1y
0
it works but it comes back up to early can you make it come back after like 2.5 seconds more? MariamOMG090 9 — 1y
View all comments (2 more)
0
done T3_MasterGamer 2189 — 1y
0
Thank You! I accepted your answer. MariamOMG090 9 — 1y
Ad

Answer this question