Quick scripting question

this is a part of a code. My player.PassStats.TierS1.Value Is 30 and i own both the gamepass and S1Starter yet somehow the result is script.Parent.Text = ‘Season 1 Tier 15’ when its supposed to say equip (yes there is another ‘elseif’ statement)

if player.PassStats.TierS1.Value < 15 and player.ValueFolder.Level.Value >= 20 or market:UserOwnsGamePassAsync(player.UserId, id) or player.StarterPacks.S1Starter.Value == true then
script.Parent.Text = 'Season 1 Tier 15'

anyone know why? if the rest of the script is needed tell me so ill share it with you guys!

1 Like

try using brackets to group specific conditions together.

for example,

if (PassStats.TierS1.Value < 15 and ValueFolder.Level.Value >= 20) or StarterPacks.S1Starter.Value == true then
	script.Parent.Text = 'Season 1 Tier 15'

that would make the text “Season 1 Tier 15” if the PassStats is less than 15 and the ValueFolder is greater than or equal to 20, OR if the StarterPacks.S1Starter is true.

I think it’s because the usage of “or” behind. You could do the first if statement with ur …or…or…, then follow up with the if statement regarding the and. I think there is a confusion of logic which makes only one condition being needed.

this was the solution thanks. and for future refrence if anyone cares here is what the script looks like now

if player.PassStats.TierS1.Value < 15 and (player.ValueFolder.Level.Value >= 20 or market:UserOwnsGamePassAsync(player.UserId, id) or player.StarterPacks.S1Starter.Value == true) then
   script.Parent.Text = 'Season 1 Tier 15'
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.