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

How would I check if an object is similar to something in my list?

I'm trying to make something in which if one thing is another thing, some thing happens. However, if it's something else, something else happens. EX: A player named Bob takes 15 damage and a player named Bobbo takes 30 damage. This is my script so far.

p = game.Players.LocalPlayer
c = p.Character
b = {"Wood half", "Dirt", "Grass", "Leaves"}
for i, v in pairs(b) do
        if v.Name == b then
		--???
	end
 end

I need to be able to pick something out of "b" and make sure it's on of the listed values in b.

1 answer

Your problem seems to be LOOPS. You need the script to loop and continuosly check to see b and its listed values. You can find more information on loops and instances here Loops & Instances

b = 1
if true then
    print(b)        --> 1
    if true then
        a = 2
        print(b)    --> 2
    end
    print(b)        --> 2
end
print(b)            --> 2
repeat wait()
 
until false
for b = NUMBER, INCREMENT do
 
end

Please PM me if you have any more questions.

Thanks

~GoodkidMad

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