Hello, so i have this script and if there is more than one model with the same name, all the texts will say “Equipped”, i tried using values but it doesn’t work…
local MainHandler = script.Parent.Parent:WaitForChild("Handler"):WaitForChild("MainFrame")
local ItemName = MainHandler:WaitForChild("ItemName")
local ItemMultiplier = MainHandler:WaitForChild("ItemMultiplier")
local ItemRarity = MainHandler:WaitForChild("ItemRarity")
local Rarity = MainHandler:WaitForChild("Rarity"):WaitForChild("Rarity")
local Client = game.Players.LocalPlayer
local Character = Client.Character
while wait(.5) do
for i, v in pairs(script.Parent:GetChildren()) do
if v:IsA("TextButton") then
v.MouseButton1Down:Connect(function()
MainHandler.Visible = true
ItemName.Value = v.ItemName.Value
Rarity.TextColor3 = v.RarityColor.Value
ItemMultiplier.Value = v.ItemMultiplier.Value
ItemRarity.Value = v.ItemRarity.Value
MainHandler.BuyButton.TextLabel.Text = "Equip"
for i,c in pairs(Character.HumanoidRootPart:GetChildren()) do
if c:IsA("Model") and ItemName.Value == c.Name then
MainHandler.BuyButton.TextLabel.Text = "Equipped"
else
MainHandler.BuyButton.TextLabel.Text = "Equip"
end
end
end)
end
end
end