I make script that you can only get if you own the gamepass but when i test its not working the locked gui is still visible …
local player = game.Players.LocalPlayer
local ownsGamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,11586496)-- put your gamepass Id here
local haloGui = script.Parent:WaitForChild("Halo")
local haloFrame = haloGui.MainFrame:WaitForChild("Blue Frame")
local locked = haloFrame:WaitForChild("Locker")
local equip = haloFrame:WaitForChild("Equipped")
local unequip = haloFrame:WaitForChild("Unequipped")
local equipped = haloFrame:WaitForChild("Equipped")
local unequipped = haloFrame:WaitForChild("Unequipped")
haloFrame.Visible = false
if ownsGamepass then
haloFrame.Visible = true
locked.Visible = false
end
if not ownsGamepass then
locked.Visible = true
haloFrame.Visible = true
equip.Visible = false
unequip.Visible = false
equipped.Visible = false
unequipped.Visible = false
end
Your script will only run one time, which is when the user first joins the game. If you buy the gamepass mid-game, it won’t update the locked gui. Try rejoining the game after you have purchased the gamepass.
Im trying to make that if players owns the gamepass the gui or frame of locker will be false and if not its true so they cant equip the gear that covering the equip.
What you should try is running a script in ServerScriptService that checks if the player owns the gamepass. If so, it uses a RemoteEvent (which is automatically created through script, so dont add one yourself) to fire to the client of the person who has the gamepass.
-- Script Inside ServerScriptService
local MarketPlaceService = game:GetService("MarketplaceService")
local GamePassID = 11586496
local EnableHaloFrame = Instance.new("RemoteEvent")
EnableHaloFrame.Name = "EnableHaloFrame"
EnableHaloFrame.Parent = game.ReplicatedStorage
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
if MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, GamePassID) then
EnableHaloFrame:FireClient(Player)
end
end)
end)
Then, you’ll want to create a script in StarterGui, which users that RemoteEvent to trigger the Guis to enable.
-- LocalScript Inisde StarterGui
local Remote = game.ReplicatedStorage:FindFirstChild("EnableHaloFrame")
local haloGui = script.Parent:WaitForChild("Halo")
local haloFrame = haloGui.MainFrame:WaitForChild("Blue Frame")
local locked = haloFrame:WaitForChild("Locker")
local equip = haloFrame:WaitForChild("Equipped")
local unequip = haloFrame:WaitForChild("Unequipped")
local equipped = haloFrame:WaitForChild("Equipped")
local unequipped = haloFrame:WaitForChild("Unequipped")
Remote.OnClientEvent:Connect(function() -- Note: Some of the true/falses' may be incorrect, so do feel free to change them to your liking.
haloFrame.Visible = true
locked.Visible = false
equip.Visible = true
unequip.Visible = true
equipped.Visible = true
unequipped.Visible = true
end)
Hope this can help! Let me know if you have any questions.