local Pants = script.Pants local Shirt = script.Shirt script.Parent.ClickDetector.MouseClick:connect(function(Player) local Character = Player.Character if Character == nil then return end -- Get new pants local CharacterPants = Character:findFirstChild("Pants") if CharacterPants then CharacterPants:Destroy() end Pants:Clone().Parent = Character -- Get new pants local CharacterShirt = Character:findFirstChild("Shirt") if CharacterShirt then CharacterShirt:Destroy() end Shirt:Clone().Parent = Character end)
How would i make this script work only if i own a certain game pass?
https://developer.roblox.com/en-us/articles/Game-Passes-One-Time-Purchases This article will tell you how to use GamePasses in your game for monetization, make sure to thoroughly read it.
For things like items you can purchase over and over go here, https://developer.roblox.com/articles/Developer-Products-In-Game-Purchases again make sure to thoroughly read it.
For this, you will be needing MarketPlaceService:UserOwnsGamePassAsync()
. You can learn more about it here
local Pants = script.Pants local Shirt = script.Shirt local MarketPlaceService = game:GetService("MarketplaceService") script.Parent.ClickDetector.MouseClick:connect(function(Player) if MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, 0) and Player.Character ~= nil then -- Change "0" to the gamepass id local Character = Player.Character -- Get new pants local CharacterPants = Character:findFirstChild("Pants") if CharacterPants then CharacterPants:Destroy() end Pants:Clone().Parent = Character -- Get new pants local CharacterShirt = Character:findFirstChild("Shirt") if CharacterShirt then CharacterShirt:Destroy() end Shirt:Clone().Parent = Character end end)
If this helped, remember to accept else report the error and I will fix it asap!