Hi, I’m making a game where if you don’t own headless, you get teleported to a different place. But the code only works for me and nobody else. Its a normal script and it is put in ServerScriptService. Why is this happening?
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local BUNDLE_ID = 201
local BUNDLE_NAME = "Headless Horseman"
local Position_Part = game.Workspace:WaitForChild("Jail_Part")
Position_Part.Transparency = 1
Players.PlayerAdded:Connect(function (player)
local success, doesPlayerOwnBundle = pcall(function()
return MarketplaceService:PlayerOwnsBundle(player, BUNDLE_ID)
end)
if success == false then
print("PlayerOwnsBundle call failed: ", doesPlayerOwnBundle)
player.Character.HumanoidRootPart.Position = Position_Part.Position
return
end
if doesPlayerOwnBundle then
print(player.Name .. " owns " .. BUNDLE_NAME)
else
print(player.Name .. " doesn't own " .. BUNDLE_NAME)
player.Character.HumanoidRootPart.Position = Position_Part.Position
end
end)
You probably want to do this on CharacterAdded, so that it only tries to teleport them after their character has already been put into workspace.
This also prevents them from just resetting and not having to go through the check again.