Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Vip Teleport Gui if you have Gamepass?

Asked by 8 years ago

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?

1 answer

Log in to vote
0
Answered by 8 years ago

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

Ad

Answer this question