Tool renaming script isn't working

The script is supposed to rename the tool and edit its attributes if certain attributes are enabled or have certain values, but its not doing that at all.

Cup = script.Parent

local Flavor = script.Parent:GetAttribute("FlavorName")
local DrinkName = script.Parent:GetAttribute("DrinkName")
local DrinkType = script.Parent:GetAttribute("DrinkType")
local DairyType = script.Parent:GetAttribute("DairyType")

local function Americano()
		if DrinkType == "Coffee" 
		and DrinkName == "Espresso"
		and Cup:GetAttribute("has_water") == true 
		then
		-- editing properties
		Cup.Name = Flavor.."Americano"
		Cup:SetAttribute("DrinkName", Cup.Name)
		Cup:SetAttribute("DrinkType", "Americano")
	end
end
script.Parent:GetAttributeChangedSignal("has_water"):Connect(Americano)

By saving the attributes to variables in the first few lines, you are saving their current stats, not the attributes themselfs. Try this instead:

local function Americano()
if script.Parent:GetAttribute(“DrinkType”)== “Coffee”
And so on

That seems to have worked, thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.