Hi, whenever I open my upgrade menu a script detects weather the player already owns the object. If the player does own the object then it should display “upgrade”, but if the player doesn’t own the object it should display “buy”.
SCRIPT:
local forgery
for i,v in pairs(workspace:WaitForChild("Forgerys"):GetChildren()) do
if v:FindFirstChild("ClaimingPart"):FindFirstChild("Occupant").Value == game:GetService("Players").LocalPlayer then
forgery = v
end
end
local miningRigs = {
"MiningRig",
"MiningRig1",
"MiningRig2",
"MiningRig3",
"MiningRig4",
"MiningRig5",
"MiningRig6",
"MiningRig7",
"MiningRig8",
"MiningRig9"
}
for i,v in pairs(forgery:FindFirstChild("Objects"):GetChildren()) do
print(v.Name)
print(script.Parent.Parent:FindFirstChild("Name").Text)
if v.Name == script.Parent.Parent:FindFirstChild("Name").Text then
script.Parent.BackgroundColor3 = Color3.fromRGB(0, 255, 255)
script.Parent.Text = "Upgrade"
else
script.Parent.BackgroundColor3 = Color3.fromRGB(0,255,0)
script.Parent.Text = "Buy"
end
end
end)```
both values I print return the same "Mining Rig" which is what it's meant to do