I'm trying to make an "Attempts" script, where you only have 5 attempts, but the script won't subtract the value.
local UName = script.Parent:WaitForChild("UName")
-------------------------------------
local UPass = script.Parent:WaitForChild("UPass")
-------------------------------------
local Attempts = script.Parent:WaitForChild("Attempts").Value
-------------------------------------
local Button = script.Parent:WaitForChild("Login")
-------------------------------------
local pass = {
["Herro"] = true;
}
-------------------------------------
local transparency = 0
-------------------------------------
local debounce = false
-------------------------------------
local countdown = 10
-------------------------------------
local warning = "You have "..Attempts.." attempts left."
----------------------
local function checkAttempts()
if Attempts == 0 then
--Randomness
else
Attempts = Attempts - 1 --Here
script.Parent.Warning.Text = warning
wait(3)
script.Parent.Warning.Text = ""
debounce = false
end
end
-------------------------------------
Button.MouseButton1Click:connect(function()
if debounce == false then
debounce = true
if pass[UPass.Text] then
--Randomness
else
checkAttempts()
end
end
end)
It will display the text, just not subtract the value. Any suggestions, because there aren't any errors.
Info:
--No filtering Enabled
--It's a local script.

2 comments
Try assigning "Attempts" to the Attempts object itself instead of the value, then use Attempts.Value whenever you wish to refer to it through your script. Let me know if that works and I will provide more details afterwards
You are using the value of attempts and but not setting them remove the "value" part at the top and change line 25 to Attempts.Value = Attempts.Value -1 so that it updates