I have this script which is located as below, and the script it SUPPOSED to give a player a tool, when they touch a part, if they own a gamepass and only if the own it.
How ever, I have failed to find out why this does not work. Could somebody please help me with this?
local id = 7746555
local MarketPlaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local Sword = game.ServerStorage.Sword8
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, id) then
local backpack = player.Backpack
debounce = false
Sword:Clone(1).Parent = backpack
wait (1)
debounce = true
end
end
end
part.Touched:Connect(onTouched)
This is a ServerScript. which is located in side of a part, and the part is called TPToArenaPart and is parented to Workspace

2 comments
Is there anything in the output?
Oh lol i fixed it i was supposed to do (player.UserId, id) on line 12