Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my script not detecting if its a premium player or not?

Asked by 1 year ago
    if players[1]:IsInGroup(5732076) then
                print("group player")
                -- group player
                players[1].leaderstats.Cash.Value = players[1].leaderstats.Cash.Value + 75
                players[1].leaderstats.Wins.Value = players[1].leaderstats.Wins.Value + 1
            elseif players[1].MembershipType == Enum.MembershipType.Premium then
                print("premium player")
                -- premium player
                players[1].leaderstats.Cash.Value = players[1].leaderstats.Cash.Value + 100
                players[1].leaderstats.Wins.Value = players[1].leaderstats.Wins.Value + 1
            else
                -- normal player
                players[1].leaderstats.Cash.Value = players[1].leaderstats.Cash.Value + Reward
                players[1].leaderstats.Wins.Value = players[1].leaderstats.Wins.Value + 1
            end

1 answer

Log in to vote
2
Answered by
pwx 1581 Moderation Voter
1 year ago
Edited 1 year ago

If they are in the group, it won't detect if they have premium too. Realistically you should be putting two if statements to detect if a player is in both.

if players[1]:IsInGroup(5732076) then
    -- do stuff here
end
if players[1].membershipType == Enum.MembershipType == Enum.MembershipType.Premium then
    -- do stuff here
end

The way you've coded it is telling the script if they're in the group, ignore the bonus for premium. Hence the 'elseif'.

Ad

Answer this question