My death screen isn’t working - I’d like someone to help me with it.
Screenshot of Fully Opened Gui:
ScoreScript text:
local score = script.Parent
local gui = script.Parent.Parent.Parent
while true do
if gui.Visible == true then
score.Text = "Score: "..math.random(1, 100)
end
wait(5)
end
The issue is that you are using .Visible on script.Parent.Parent.Parent, which is a ScreenGui, which does not have that property, but has .Enabled instead.
local score = script.Parent
local gui = script.Parent.Parent.Parent
while true do
if gui.Enabled == true then
score.Text = "Score: "..math.random(1, 100)
end
wait(5)
end
Using a while true do loop just to check every time, each second, or any selected wait duration is a bad practice. You should use the GetPropertyChangedSignal event instead.
local score = script.Praent
local gui = script.Parent.Parent
gui:GetPropertyChangedSignal("Enabled"):Connect(function()
if gui.Enabled then
score.Text = "Score: " .. math.random(1, 100);
end
end)
I’d also like to point out like PhoenixRessusection; you are trying to use .Visible on script.Parent.Parent.Parent which is a ScreenGUI instance. ScreenGUIs do not have that property, rather, they have the Enabled property.