This don't works because of coding logic(don't worry, i'll explain), so, basically, that variable definition is just a logic for code, waiting for the first true:
If you do
local var = "Text" or "Other text"
var will aways be "Text"
thats because of logic, basically, your code is trying to get a true on that, and because its a string, its aways true.
local var = (var1 == 1) and "text" or "other text"
^^ this is also coding logic, basically, it will set the variable to "text" if var1 is equals to 1, if its not, it will set to "other text"
I know this seems complicated, but its not easy to explain it.
Now into your code, that variable Undeletable is aways "Golden Dominus", what you can do is defining that strings inside a table, and then checking if equals to any of the values.
Here's how to do it:
local Undeletable = {
"Golden Dominus", "Aqua Dragon", "Dominus Aura", "Shiny Dog", "Shiny Cat", "Shiny Chicken", "Shiny Turtle"
}
Now, your variable is a table, so, how to check the values?
We can use a for ... do loop:
v.MouseButton1Click:Connect(function()
local cantdelete = false
for _,v in pairs(Undeletable) do
if PetNames == v then
cantdelete = true
break
end
end
if cantdelete then
delete.Visible = false
else
delete.Visible = true
end
if PetNames == Undel then
shiny.Visible = false
else
shiny.Visible = true
end
end)
Useful links:
DevAPI/Scopes
DevAPI/Loops#for-do
DevAPI/Tables
DevAPI/Conditional Structures
if this helps, please upvote and mark this answer as accepted
8 comments
:|
?
this looks a bit complicated
ohhh just noticied your answer, looks like I was faster
its not, the complicated part is the coding logic, there's nothing exactally explaining it anywhere on the internet
yes and i think mine is the right one
i would just do and instead of the table
Thanks! :D