Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

This search script isn't working?

I've made this yesterday, then I forgot to save my studio and made it again but this time a little better. When I try to search "Wood" or anything else that's searchable, it says "Type here is not a valid member of ScrollingFrame" (Type here is the acutal text of the textbox)

My script:

bar = script.Parent.Parent.SearchBar
text = bar.Text
button = script.Parent
frame = script.Parent.Parent.ScrollingFrame
dirt = frame.Dirt
grass = frame.Grass
sand = frame.Sand
ice = frame.Ice
wood = frame.Wood
stone = frame.Stone
all = frame:GetChildren()
button.MouseButton1Click:connect(function(search)
	stone.Visible = false
	dirt.Visible = false
	grass.Visible = false
	ice.Visible = false
	sand.Visible = false
	wood.Visible = false
	wait(.1)
	frame[text].Visible = true
end)

1 answer

✓ Accepted answer

Your problem is line 2. This mistake is made very often. When you set a variable to an object's property, the variable simply becomes the value of that property, retaining no reference to the object. This means that the variable will not change if the property changes later.

Make your variables equal to objects, then access the properties like so;

local part = workspace.Part
part.Transparency = 1

1 comment

0

Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.