Ive been struggling on scripting a gui teleport when you click it, it sends you to vip but only if you have that pass. Ive looked on the wikis and am still confused. Any Help?
COMMUNITY QUESTION
Vip Teleport Gui if you have Gamepass?
1 answer
Well, to teleport someone, you need to set their CFrame to the position you want them to go, for example:
torso.CFrame = CFrame.new(TelePart.Position)
This is how you check to see if a player has a pass:
local service = game:GetService("GamePassService)
if service:PlayerHasPass(playerObject,passId) then
print(playerObject.Name.. " owns the pass " ..passId)
end
To compile it in a Gui button (make the script a LocalScript inside the button):
local telePart = game.Workspace:WaitForChild("VIPTeleportPart")
local b = script.Parent
local p = game.Players.LocalPlayer
local torso = p.Character:WaitForChild("Torso")
local service = game:GetService("GamePassService)
local passId = 0000
local ownsPass = false
if service:PlayerHasPass(p,passId) then
print(p.Name.. " owns the pass " ..passId)
ownsPass = true
end
b.MouseButton1Down:connect(function()
if ownsPass == true then
torso.CFrame = CFrame.new(telePart.Position + Vector3.new(0,7,0)) -- so the player teleports above the pad, not in it
end
end
end)
Comment if you need anything else explained!
Hope I helped :)
~TDP
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
http://wiki.roblox.com/index.php?title=API:Class/GamePassService