Hello
I have an IntValue located in Replicated Storage and when you press a button, the value of the IntValue changes to the placeId of a map.
Once it changes, inside of the server script service I have a party system script which teleports the group of players in the party to the placeId inside IntValue.
But when I press the teleport button, the output shows me:
Cannot teleport to invalid place id 0. Aborting teleport.
I have these variables as well :
local tps = game:GetService("TeleportService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local lol = game.ReplicatedStorage.lol local placeId = lol.Value
lol is the name of the IntValue inside ReplicatedStorage
And the teleport I am using :
tps:TeleportPartyAsync(placeId, playersToTP, tpOptions)
Can placeId be used as a variable or does it always have to be a direct number?
this is the code you should be using, you can put the place ID here and change the enum.membership type to none. if you want premium and nonpremium members to join, make a copy of this code, one copy should say Enum.Membership type premium and one should say none.
this is the right one
local MarketplaceService = game:GetService("MarketplaceService") local TeleportService = game:GetService("TeleportService") local Players = game:GetService("Players")
local teleporter = script.Parent local showPrompt = true
local placeID_Premium = -- Insert place ID here; can be found in web address bar on the game's page
local function onTeleporterTouch(otherPart)
local player = Players:GetPlayerFromCharacter(otherPart.Parent) if not player then return end -- If the user already has Premium, teleport them to the Premium-only place if player.MembershipType == Enum.MembershipType.Premium then TeleportService:Teleport(placeID_Premium, player) -- Else, prompt Premium upgrade (use debounce to show it only once every few seconds) else if showPrompt == false then return end showPrompt = false delay(5, function() showPrompt = true end) MarketplaceService:PromptPremiumPurchase(player) warn("Prompted Premium purchase") end
end teleporter.Touched:Connect(onTeleporterTouch)
-- If needed, use this event to know when the Premium modal is closed MarketplaceService.PromptPremiumPurchaseFinished:Connect(function(player) warn("Upsell modal closed") end)
-- Handle potential Premium purchase from outside the game while user is playing Players.PlayerMembershipChanged:Connect(function(player) warn("Player membership changed; new membership is " .. tostring(player.MembershipType)) if player.MembershipType == Enum.MembershipType.Premium then -- Teleport player to the Premium-only place TeleportService:Teleport(placeID_Premium, player) end end)
hope this helped!! if any more questions please message me and follow me on roblox