i want proximity prompts with a certain attribute to be visible to the client
Local Script:
Remotes.Claimed.OnClientEvent:Connect(function(shop)
for _, v in workspace.Shops:GetDescendants() do
if v:IsA("ProximityPrompt") and v:GetAttribute("ClientPrompt") == nil then
v.Enabled = false
end
end
if shop == nil then
print("Could not find shop")
return
end
for _, v in shop:GetDescendants() do
if v:IsA("ProximityPrompt") then
v.Enabled = true
end
end
end)
Server Side:
local newTemp = ShopTemp:Clone()
Remotes.Claimed:FireClient(player, newTemp)
If you use SetAttribute at all, it will have the attribute set to false, so checking if it’s nil won’t work.
for i, v in next, workspace.Shops:GetDescendants(), nil do
if v:IsA("ProximityPrompt") and v:GetAttribute("ClientPrompt") == false then --no logic statement, that would check if it exists.
--do stuff
end
end
It is just an iteration function, to be fair you don’t even need to use them now you can just do loops like the following
for i, v in workspace.Shops:GetDescendants() do
if v:IsA("ProximityPrompt") and v:GetAttribute("ClientPrompt") == false then --no logic statement, that would check if it exists.
--do stuff
end
end
for i, v in workspace:WaitForChild("Shops"):GetDescendants() do
if v:IsA("ProximityPrompt") and v:GetAttribute("ClientPrompt") == false then --no logic statement, that would check if it exists.
--do stuff
end
end
Oh i see now actually, you must parent the instance before sending it over to the client, as it would not of replicated at all, parent it to the workspace or at least replicated storage