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

VIP bool value not being created why is this?

Asked by
Vxpper 101
5 years ago

I'm creating values in a player for easier game use, and the VIP(lines 10-14), bool values aren't being created or turned to true. I own these items and I don't know what is wrong.

local mps = game:GetService("MarketplaceService")

function Validate(Players)
    if
        Players:IsInGroup(1200769) then
        local tag = Instance.new("BoolValue",Players)
        tag.Name = "RobloxStaff"
        tag.Value = true
    elseif
        mps:UserOwnsGamePassAsync(Players.UserId, 7222195) then
        local tag = Instance.new("BoolValue",Players)
        tag.Name = "VIP"
        tag.Value = true
    elseif
        Players:IsInGroup(4475945) then
        local tag = Instance.new("BoolValue",Players)
        tag.Name = "Fan"
        tag.Value = true
    elseif
        mps:UserOwnsGamePassAsync(Players.UserId, 0) then   
        local tag = Instance.new("BoolValue",Players)
        tag.Name = "GPPACK1"
        tag.Value = true        
    end
end

game.Players.PlayerAdded:Connect(Validate)

for i,Player in pairs(game.Players:GetPlayers()) do
    Validate(Player)
end
0
Why don't you just have these values already in a player when a player joins so you don't need to create new ones every single if statement? Then each gamepass check would just turn them false or true. SteamG00B 1633 — 5y
0
Also recheck to see if you've got the right gamepass ID SteamG00B 1633 — 5y
0
Well I tested your script and it works. I changed the gamepass id to my gamepass and it detects that i have it and created the tag for me. I assume that u dont have the gamepass. You should mayb double check. XviperIink 428 — 5y
0
This is yet another example of using value objects where a Lua table should be used. ValueObjects were meant for authoring-time configuration, not so you can use a 60+ byte Instance to store a boolean. EmilyBendsSpace 1025 — 5y
0
@EmilyBendsSpace I'm going to use a model full of StringValues as a table of strings and you can't stop me! SteamG00B 1633 — 5y

1 answer

Log in to vote
0
Answered by
Vxpper 101
5 years ago

A silly mistake I'm creating a group game and I forgot to buy the pass

Ad

Answer this question