The goal of this script is to continuously run in a loop, always hitting the "else" statement until it eventually turns "Visible" and then it would end the loop.
Clearly that's not whats happening! Currently when running it does print "Invisible" once then stops, meaning its not looping. I believe my error lies in the "until found" line, but I'm unsure of how to run this the correct way.
For backstory this is a tycoon and i need this to activate once an object is purchased and moved into the referenced location with referenced name.
local found = script.Parent.Parent.Parent.Parent.PurchasedObjects:FindFirstChild("FirstFloorStairs")
if found then
print("Visible")
script.Parent.Transparency = .5
else
print("Invisible")
script.Parent.Transparency = 1
repeat
until found
end
Any pointers or help is much appreciated, I'm very new to the scene :).
EDIT
local list = script.Parent.Parent.Parent.Parent.PurchasedObjects:GetChildren() -- get the list of items in a loop
for _, v in pairs(list) do
if v.Name == "FirstFloorStairs" then
script.Parent.Transparency = .5 -- visible!!
print("Visible")
end
end
local ts = game:GetService("TweenService") --tween service
local list = script.Parent.Parent.Parent.Parent.PurchasedObjects:GetChildren() --just a list
local tinfo = TweenInfo.new(
0.7,--time it takes to tween
Enum.EasingStyle.Sine,--the easing style(mainly for looks)
Enum.EasingDirection.Out,--again for aestetics
0,--times it repeats
false,--whether it reverses
0-- delay between repeats
)--tween info
local properties = {Transparency = .5}
for _, v in pairs(list) do
if v.Name == "FirstFloorStairs" then -- if the item is a part
script.Parent.Transparency = 1 -- make the blocks invsible
local tween = ts:Create(script.Parent,tinfo,properties)--creates a tween
tween:Play()
end
end -- create a loop

9 comments
Sorry i think i explained the issue incorrectly! My goal is to make a specific part VISIBLE based on the existence of another part. I've editted what you gave me in a failed attempt to make that work. Ill edit to show you.
Great Neil basically has the gist of it
Just take what greatness typed and change it
shouldn't be to hard
great Neil basically got the main part of it
Sorry for splitting the comment my computer is really buggy rn
Alright I'll edit it
You’re a king among men! Thank you Neil! I am using a model, but I should hopefully be able to figure out the necessary changes for that.
Alright! You are welcome. If you need any help with anything else, ask me :)