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

Teleport Only for gamepass owners?

Asked by 5 years ago
Edited 5 years ago

So I have a game that if you buy vip you can teleport to a vip room but it doesn't work like it works for the first time but when someone steps on it with vip then anyone can teleport!

here is the code I use


local id = 4795249 game.Players.PlayerAdded:Connect(function(player) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,id) then local Teleport = "Tele1" --Put the name of the Part between the ""s. local function Touch(hit) if script.Parent.Locked == false and script.Parent.Parent:findFirstChild(Teleport).Locked == false then script.Parent.Locked = true script.Parent.Parent:findFirstChild(Teleport).Locked = true --Checks Debounce. local Pos = script.Parent.Parent:findFirstChild(Teleport) --Gets the Part to teleport to. hit.Parent:moveTo(Pos.Position) wait(1) script.Parent.Locked = false script.Parent.Parent:findFirstChild(Teleport).Locked = false end end --Takes you there and Ends the Function. script.Parent.Touched:connect(Touch) game.Players.PlayerAdded:Connect(function(player) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,id) then print() else script.Disabled = true end end) end end)

Answer this question