local MarketplaceService = game:GetService("MarketplaceService") local Players = game:GetService("Players") local passId = 4764164 local function onPlayerAdded(player) local hasPass = false hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, passId) if hasPass == true then game.StarterGui.guimobile.Omnitrix.Frame.Visible = true if hasPass == false then game.StarterGui.guimobile.Omnitrix.Frame.Visible = false end end end Players.PlayerAdded:Connect(onPlayerAdded)
I'm a beginner at scripting so I don't know much about why it's wrong.
On line 17: change if to elseif and delete the end on line 21. Also on line 15 and 19: change game.StarterGui to: player:WaitForChild("PlayerGui") (it may not work though) Code:
local MarketplaceService = game:GetService("MarketplaceService") local Players = game:GetService("Players") local passId = 4764164 local function onPlayerAdded(player) local hasPass = false hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, passId) if hasPass == true then game.StarterGui.guimobile.Omnitrix.Frame.Visible = true elseif hasPass == false then game.StarterGui.guimobile.Omnitrix.Frame.Visible = false end end Players.PlayerAdded:Connect(onPlayerAdded)