im making some script, one of then is "if race == X" then change body, but its only for certain races, theres is a lot and i dont do it for almost half of them, so i wanted a way to do a "wait until race is X" i just did if characterAdded and then later "if player.Race == X" then do it, but sometimes my race was this "X" and dont worked, i needed to reset for it work, so i thought in use "wait(3)" or "repeat wait() until plr.Race=="X" ", something like this, but it a good way? wts the better use to it?
another use for it is, each race has some skills and depending on the race i will give those skills so i thought in use this:
repeat wait() until race.Value ~= nil or race.Value ~=""
and then do the "skillX:clone()" in starterpack, wt u guys think, its good?

9 comments
but i want to it to do 1 time, like "if your race is X, ill give u this skill" and its it, i dont want a loop inside, idk if while is a better choice in this case
then i guess using a coroutine is better then, i'll update soon
updated
so when "race~= null" it will run that code block?
yes and only once
ill try then, thx
Coroutines is a MUCH worse solution, also you shouldn't be using "or" there, regardless if it is "" or nil, it will run because the other conditional contradicts the former and latter. On top of this, you could substitute it for a function that would basically make this serve no purpose
repeat wait() until "something" is better? i want something for just:
repeat wait() until "something" is better? i want something for just: when i join, ill get a race and then it'll do and give me things, wt would be the better option for "wait until race is not nil and then do these things"?