Im trying to make a warning GUI appear when a player doesn't meet the leaderstats requirements when attempting to unlock a door.
local required_points = 8000
local warning = script.Parent.ScreenGui.Warning
local db = true
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local time_remaining = player.leaderstats.Time.Value
if player.leaderstats.Time.Value >= required_points then
if db then
db = false
script.Parent.Transparency = 0.5
script.Parent.CanCollide = false
wait(3)
script.Parent.CanCollide = true
script.Parent.Transparency = 0
db = true
end
else
print (type(time_remaining))
print (type(script.Parent.ScreenGui.Time.Text))
warning.Visible = true
wait(4)
warning.Visible = false
time_remaining = tostring(time_remaining)
script.Parent.ScreenGui.Time.Text = "You have " + time_remaining + " minutes."
script.Parent.ScreenGui.Time.Visible = true
wait(4)
script.Parent.ScreenGui.Time.Visible = false
end
end
end)
script.Parent.ScreenGui.Time.Text = "You have " + time_remaining + " minutes." was the line that had the error

2 comments
Beat you. ;)
:(