I'v tried a lot couldn't find anything on YouTube or anything from open sources that let me make a script like this. The point is that if a user owns a Gamepass the permanently get a tool, I'm not the best with FE scripting but I tired. Heres what I got
LocalScript (Located in startergear)
local ReplicatedStorage = game:GetService("ReplicatedStorage") local GamepassEvent = ReplicatedStorage:WaitForChild("GamepassEvent") GamepassEvent:FireServer()
Script (ServerScriptStorage)
local ReplicatedStorage = game:GetService("ReplicatedStorage") local GamepassEvent = Instance.new('RemoteEvent', ReplicatedStorage) GamepassEvent.Name = "GamepassEvent" local function OnGamepassEventFired() local id = 4760037 game.Players.PlayerAdded:connect(function(player) if game:GetService("GamePassService"):PlayerHasPass(player, id) then game.ServerStorage["Tool"]:Clone().Parent = game.Players.LocalPlayer.StarterGear else print(player.Name .. " doesn't have the game pass...") end end) end
Any help will be greatly appreciated.
Connect
your FireServer
to an OnServerEvent
PlayerAdded
event properlyGamePassService:PlayerHasPass()
when it is brokenlocal id = 4760037 local marketplaceService = game:GetService"MarketplaceService" GamepassEvent.OnServerEvent:Connect(function(player) if marketplaceService:UserOwnsGamePassAsync(player.UserId, id) then local tool = game:GetService("ServerStorage").Tool tool:Clone().Parent = player.Backpack tool:Clone().Parent = player.StarterGear else print"User doesn’t own pass" end end)
Connect
, as ROBLOX may discontinue connect
in the future. Also, don’t put your PlayerAdded
event inside the function, instead connect a function to the event. But as you can see, we didn’t use PlayerAdded
.