Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I make this Gamepass teleport working? (I pay 200 bux for the solution)

Here you see a Gamepass teleport. But it is not working. It always worked before the big gamepass change... So I tried changing some stuff. but now it says that line 37 is not connecting to the int64 or something.

If you know the solution I will buy anything from you for 200 bux.

I think the problem is with this line: if MarketPlaceService:UserOwnsGamePassAsync(player, GamePassIdObject.Value) then

``~~~~~~~~~~~~~~~~~

--| WaitForChild |--

-- Waits for parent.child to exist, then returns it local function WaitForChild(parent, childName) assert(parent, "ERROR: WaitForChild: parent is nil") while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end return parent[childName] end


--| Variables |--

local MarketPlaceService = Game:GetService('MarketplaceService') local PlayersService = Game:GetService('Players') local DebrisService = Game:GetService('Debris')

local Teleporter = script.Parent

local GamePassIdObject = WaitForChild(script, 'GamePassId') local ExitPartObject = WaitForChild(script, 'ExitPart')

local JustTouched = {}


--| Functions |--

-- When a player with the game pass touches the door, teleport them to the other side local function OnTouched(otherPart) if otherPart and otherPart.Parent and otherPart.Parent:FindFirstChild('Humanoid') then local player = PlayersService:GetPlayerFromCharacter(otherPart.Parent) if player and not JustTouched[player] then JustTouched[player] = time() if MarketPlaceService:UserOwnsGamePassAsync(player, GamePassIdObject.Value) then local character = player.Character if not character:FindFirstChild('JustTeleported') then local justTeleported = Instance.new('StringValue') justTeleported.Name = 'JustTeleported' DebrisService:AddItem(justTeleported, 0.3) justTeleported.Parent = character character:MoveTo(ExitPartObject.Value.Position) end end end end end

-- Removes old entries in JustTouched local function RemoveOldTouches() for player, touchTime in pairs(JustTouched) do if time() > touchTime + 0.3 then JustTouched[player] = nil end end end


--| Script Logic |--

Teleporter.Touched:connect(OnTouched)

while true do RemoveOldTouches() wait(1/30) end


2 comments

0

There is a button called "Code Block", please wrap your code inside of that without any syntax interruptions

0

Read website guidelines, 4. Do not offer rewards for answers to questions. https://scriptinghelpers.org/help/community-guidelines

1 answer

local function WaitForChild(parent, childName)
	assert(parent, "ERROR: WaitForChild: parent is nil")
	while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
	return parent[childName]
end

-----------------
--| Variables |--
-----------------

local MarketPlaceService = Game:GetService('MarketplaceService')
local PlayersService = Game:GetService('Players')
local DebrisService = Game:GetService('Debris')

local Teleporter = script.Parent

local GamePassIdObject = WaitForChild(script, 'GamePassId')
local ExitPartObject = WaitForChild(script, 'ExitPart')

local JustTouched = {}

-----------------
--| Functions |--
-----------------

-- When a player with the game pass touches the door, teleport them to the other side
local function OnTouched(otherPart)
	if otherPart and otherPart.Parent and otherPart.Parent:FindFirstChild('Humanoid') then
		local player = PlayersService:GetPlayerFromCharacter(otherPart.Parent)
		if player and not JustTouched[player] then
			JustTouched[player] = time()
			if MarketPlaceService:UserOwnsGamePassAsync(player, GamePassIdObject.Value) then
				local character = player.Character
				if not character:FindFirstChild('JustTeleported') then
					local justTeleported = Instance.new('StringValue')
					justTeleported.Name = 'JustTeleported'
					DebrisService:AddItem(justTeleported, 0.3)
					justTeleported.Parent = character
					character:MoveTo(ExitPartObject.Value.Position)
				end
			end
		end
	end
end

-- Removes old entries in JustTouched
local function RemoveOldTouches()
	for player, touchTime in pairs(JustTouched) do
		if time() > touchTime + 0.3 then
			JustTouched[player] = nil
		end
	end
end

--------------------
--| Script Logic |--
--------------------

Teleporter.Touched:connect(OnTouched)

while true do
	RemoveOldTouches()
	wait(1/30)
end

6 comments

0

Maybe also good to notice that GamePassId and Exitpart are 2 object inside the script. see rule 17 and 18

0

just saying, you should explain your changes instead of just pasting a script

0

Please write your own Scripts, this is obviously a template as it's using extremely outdated methods.

0

Likely though, your 'WaitForChild' function, which isn't needed. Isn't working.

0

Let I say it in a otherway...

0

If somone can give me a Gamepass teleporter that works. I will pay 200 bux :P

This discussion is preserved as it was. New answers, comments, and votes are closed.