So I have
local mousetarget =
What would I put to the right of the equal sign, for it to be every brick in workspace that has a bool value in it named "Purchase" that is true?
So I have
local mousetarget =
What would I put to the right of the equal sign, for it to be every brick in workspace that has a bool value in it named "Purchase" that is true?
Its quite simple, you just have to iiterate through every object in workspace. and check if it have the value.
for i,v in pairs(game.Workspace:GetChildren()) do
if v:FindFirstChild("Purchased") ~= nil then
localMouseTarget = v
end
end
"v" would be an object, this might not work but it should, if it doesn't try making a table and inserting v into a table.
There is nothing for that, there is a loop though...
for _, v in pairs(workspace:GetChildren()) do
if v:FindFirstChild("Purchase") then
if v.Purchase.Value == true then
local mousetarget = v
print(mousetarget.Name)
end
end
end
looping and finding purchased through all the parts then finding if its value is true then making the "mousetarget" the part...
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
thx