Hello guys, today i am trying to make Trail gamepass. I made it but idk how to make it better.
local Player = game:GetService("Players").LocalPlayer local ServerStorage = game:GetService("ServerStorage") local BlackTrail = ServerStorage:WaitForChild("BlackTrail") local YellowTrail = ServerStorage:WaitForChild("YellowTrail") local OrangeTrail = ServerStorage:WaitForChild("OrangeTrail") for _, thing in pairs(script.Parent:GetChildren()) do if thing.ClassName == "ImageButton" then thing.MouseButton1Click:Connect(function() if thing:FindFirstChild("HasThis").Value == true then if not thing:FindFirstChild("Equipped").Value == false then thing:FindFirstChild("Equipped").Value = true local Character = Player.Character or Player.CharacterAdded:Wait() if thing:FindFirstChild("Color").Value == "Black" then --idk how can i script here elseif thing:FindFirstChild("Color").Value == "Orange" then -idk how can i script here elseif thing:FindFirstChild("Color").Value == "Yellow" then -idk how can i script here end end else thing:FindFirstChild("Equipped").Value = false end end) end end
You would use MarketPlaceService. For example,
local MarektplaceService = game:GetService("MarketplaceService") if MarektplaceService:UserOwnsGamePassAsync(Player.UserId, 111111) then -- Change Id to whatever you want it to be. -- Your function goes here. end