So, in my game, I have a shop. The buy button is supposed to update to "Equip," "Equipped," etc, but it doesn't work right. Even if the player's equipped value is a certain skin, it won't say equipped! Client - side script:
boxName:GetPropertyChangedSignal("Value"):Connect(function()
local model = nil
for i, object in pairs(game.Workspace.Shop.ItemRoller["Box"..boxName.Value]:GetChildren()) do
if object:IsA("Model") then
model = object
end
end
local toolsBought = game.ReplicatedStorage.GetSkinsBought:InvokeServer()
for i, tool in pairs(toolsBought) do
if tool == model.Name then
script.Parent.Text = "Equipped"
else
script.Parent.Text = "Equip"
end
end
print(script.Parent.Text)
end)
(The parent is the button.)
Server - side:
game.ReplicatedStorage.GetSkinsBought.OnServerInvoke = function(player)
local tools = {}
for i, tool in pairs(game.ServerStorage.PlayerSkins[player.Name]:GetChildren()) do
table.insert(tools,tool.Name)
print(tool)
end
return tools
end
HELP
