code is this
local id = 7746555 local MarketPlaceService = game:WaitForChild:FindFirstChild("MarketplaceService") local Players = game:("Players") local Sword = game.ServerStorage.Sword local debounce = true local part = script.Parent local function onTouched(part) local player = Players:GetPlayerFromChar(part.Parent.) if not player then return end if debounce == true then if MarketPlaceService:UserOwnerOfGamePass(UserId id) then local backpack = player.Backpack debounce = false Sword:Clone(1).Parent = backpack wait (1) debounce = true end end end part.Touched:Connect(onTouched) == true
Old script:
local id = 7746555 local MarketPlaceService = game:WaitForChild:FindFirstChild("MarketplaceService") -- This is incorrect, It’s suppose to be game:GetService("MarketplaceService"). also, never use findfirstchild after wait for child local Players = game:("Players") local Sword = game.ServerStorage.Sword local debounce = true local part = script.Parent local function onTouched(part) local player = Players:GetPlayerFromChar(part.Parent.) -- it’s suppose to be GetPlayerFromCharacter if not player then return end if debounce == true then if MarketPlaceService:UserOwnerOfGamePass(UserId id) then -- There are like 4 errors in this, you need assistance with questions local backpack = player.Backpack debounce = false Sword:Clone(1).Parent = backpack wait (1) debounce = true end end end part.Touched:Connect(onTouched) == true -- Don’t add == true
New script:
local id = 7746555 local MarketPlaceService = game:GetService("MarketplaceService") local Players = game:GetService("Players") local Sword = game.ServerStorage.Sword local debounce = true local part = script.Parent local function onTouched(part) local player = Players:GetPlayerFromCharacter(part.Parent.) if not player then return end if debounce == true then if MarketPlaceService:UserOwnsGamePassAsync(player,UserId id) then local backpack = player.Backpack debounce = false Sword:Clone(1).Parent = backpack wait (1) debounce = true end end end part.Touched:Connect(onTouched)
You have numerous errors, I recommend researching this topic.