So basically I need to give this all item when character teleported. But a special item is given if you bought a pass. Everything works without the marketplace thing, but when I add it, it break the script. How do I make this work? I noted what area might be broken.
BTW, I am using a receipt processing for my radio already. my research is pointing out that I can only do 1 receipt processing,
function onTouched(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
local a = math.random(1,4)
if a == 1 then
hit.Parent:MoveTo(Vector3.new(workspace.Tp1.Position.x,workspace.Tp1.Position.y+8,workspace.Tp1.Position.z))
elseif a == 2 then
hit.Parent:MoveTo(Vector3.new(workspace.Tp2.Position.x,workspace.Tp2.Position.y+8,workspace.Tp2.Position.z))
elseif a == 3 then
hit.Parent:MoveTo(Vector3.new(workspace.Tp3.Position.x,workspace.Tp3.Position.y+8,workspace.Tp3.Position.z))
elseif a == 4 then
hit.Parent:MoveTo(Vector3.new(workspace.Tp4.Position.x,workspace.Tp4.Position.y+8,workspace.Tp4.Position.z))
if (not player.Backpack:FindFirstChild('ClassicSword')) then
game.Lighting:findFirstChild("ClassicSword"):Clone().Parent = player.Backpack
end
if (not player.Backpack:FindFirstChild('Pistol')) then
game.Lighting:findFirstChild("Pistol"):Clone().Parent = player.Backpack
end
if (not player.Backpack:FindFirstChild('RocketLauncher')) then
game.Lighting:findFirstChild("RocketLauncher"):Clone().Parent = player.Backpack
end
local gpid = 6677112 -- Gamepass ID
local tools = {"HyperlaserGun"}
local GPS = game:GetService("GamePassService")
if GPS:PlayerHasPass(player, gpid) then --I think this is the broken area
print("Has pass")
for _,v in pairs(tools) do
if (not player.Backpack:FindFirstChild('RocketLauncher')) then
game.Lighting:findFirstChild("RocketLauncher"):Clone().Parent = player.Backpack
else
print("Has no pass")
end
end
end
end
end
end
script.Parent.Touched:connect(onTouched)

2 comments
hello may i politely ask what the heck is your indenting
I was trying to make Line 25 work. I don't know whats wrong with it.