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 create a teleport gamepass script?

I was wondering if anyone could help me? I'm trying to create a script for 2 parts where if when you touch part1 and you own a gamepass, you will be teleported to part2 If you don't own the gamepass you won't be teleported. I've tried using a free model one but it just puts me on the roof.

1 answer

Make a Sever script inside part1. Put this as the code

script.Parent.Touched:Connect(function(touch) -- If player touchs part1
	local gamepass = 11111 -- Change this to your gamepass's ID

	local plr = game.Players:GetPlayerFromCharacter(touch.Parent) --Get the player from their character since this is a server script
	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId, gamepass) then -- Check if the player owns the gamepass
	game.Workspace[plr.Name].UpperTorso.CFrame = game.Workspace.Part2.CFrame	--If so Teleport them to Part2 which is the other part	
end
end)

3 comments

0

UpperTorso isn't a valid member of Model

0

Nevermind I fixed it

0

Thank you so much!

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