I tried this:
-- In workspace normalscript local MpS = game:GetService"MarketplaceService" local gamepass = 4775497 local tool = {"Glock 18"} workspace.ChildAdded:connect(function(plr) local player = game.Players:FindFirstChild(plr.Name) local backpack = player:WaitForChild("Backpack") if MpS:UserOwnsGamePassAsync(player.UserId, gamepass) then game.ServerStorage:FindFirstChild(tool):Clone().Parent = backpack end end)
i know this is a bad way but i tried something...
Lighting
as storage, as this is deprecated and not supported by ROBLOX. Move the tool to ReplicatedStorage
for client and server access. Move to ServerStorage
for server only access. Your problem is on lines 4 and lines 10, you’re trying to find a table in Lighting
. Index the item in the table.local MpS = game:GetService"MarketplaceService local gamepass = 4775497 local tool = {"Glock 18"} game:GetService("Players").PlayerAdded:Connect(function(plr) if Mps:UserOwnsGamePassAsync(plr.UserId, gamepass) then if game:GetService("ServerStorage"):FindFirstChild(tool[1]) then local clone = game:GetService("ServerStorage")[tool[1]]:Clone() clone.Parent = player.StarterGear clone:Clone().Parent = player.Backpack end end end)
Connect
, as ROBLOX may remove connect
in the future.