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

How to make a gamepass script that when you touch a part you get teleported to another game?

Well, i was trying to make a gamepass script that when you touch it, it teleports you to another game i'm still a beginner and i need help.

3 comments

0

You should probably try the function that teleports you to games, when you touch a part, or click a gui. I'm not setting this as an answer, since I don't know if it works. If it doesn't, follow a tutorial. At least try <3 (no downvoty v.v)

0

ANTI-DOWNVOTEANTI-DOWNVOTEANTI-DOWNVOTEANTI-DOWNVOTEANTI-DOWNVOTEANTI-DOWNVOTEANTI-DOWNVOTEANTI-DOWNVOTE

1 answer

✓ Accepted answer

Input a Server Script in ServerScriptService with the following code or refer to the bottom for a better alternative

-- >> Server Script Service
local gamepassID = 000 -- Change to your gamepass ID
local placeID = 000
local TS = game:GetService("TeleportService")
local MS = game:GetService("MarketplaceService")

workspace.Part.Touched:Connect(function(hit) -- On touch event
	if hit.Parent:FindFirstChild("Humanoid") then -- Finds a humanoid if it's a player
		local plr = game.Players:GetPlayerFromCharacter(hit.Parent) -- Sets the player

		if MS:UserOwnsGamePassAsync(plr.UserId, gamepassID) then -- Checks if the player owns the pass
			TS:Teleport(placeID, plr) -- Teleports the player to the place
		end
	end
end)	

-- >> Better alternative
-- Local Script In Starter Gui
local plr = game.Players.LocalPlayer
local MS = game:GetService("MarketplaceService")
local TS = game:GetService("TeleportService")
local passID = 000
local placeID = 000

workspace.Part.Touched:Connect(function(hit) -- On touch event
	if MS:UserOwnsGamePassAsync(plr.UserId, passID) then -- Checks if the player owns the pass
		TS:Teleport(placeID, plr) -- Teleports the player to the place
	end
end)

2 comments

0

-1 for spoonfeeding

0

+1 for helping out the guy out

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