Ad
Log in to vote
-1

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

Asked by 7 years ago

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

Log in to vote
0
Answered by 7 years ago

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

Ad

Answer this question