Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can i make an Trail gamepass?

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

1 comment

0

This won't work in-game. A LocalScript cannot access ServerStorage and a Server Script cannot access LocalPlayer

1 answer

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 

3 comments

0

lol i did already

0

I am using RemoteEvent for that lol

0

So what are you trying to do? make the script neater?

This discussion is preserved as it was. New answers, comments, and votes are closed.