I want want to have a if statement that checks if the value of the attribute is a certain string. But I don’t know how to do this.
1 Like
local attribute = Instance:GetAttribute("AttributeName") -- 'Instance' would be the object that's holding the attribute.
local attributeType = typeof(attribute) -- This calls the global 'typeof' function to get the type of the value the 'attribute' variable is
print(attributeType) -- Prints string, number, nil, Vector3, etc
Docs: Roblox Globals | Roblox Creator Documentation
But I have a feeling that this is what you’re referring to:
local attribute = Instance:GetAttribute("AttributeName")
if attribute == "stringvalue" then
-- This checks if the value of the attribute matches the string
end
5 Likes