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

How can I create a teleport gamepass script?

Asked by 4 years ago
Edited 4 years ago

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

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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)
0
UpperTorso isn't a valid member of Model Screaming_Monkeys 4 — 4y
0
Nevermind I fixed it Screaming_Monkeys 4 — 4y
0
Thank you so much! Screaming_Monkeys 4 — 4y
Ad

Answer this question