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

How can i make an Trail gamepass?

Asked by 5 years ago

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
0
This won't work in-game. A LocalScript cannot access ServerStorage and a Server Script cannot access LocalPlayer green271 635 — 5y

1 answer

Log in to vote
0
Answered by
B_rnz 171
5 years ago

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 

0
lol i did already FrezeTagger 75 — 5y
0
I am using RemoteEvent for that lol FrezeTagger 75 — 5y
0
So what are you trying to do? make the script neater? B_rnz 171 — 5y
Ad

Answer this question