Answered by
5 years ago Edited 5 years ago
Hello! Try this script. Make sure to put it as a normal script under the part that you want a player to touch to enter the building. Also, change the variable gamepassId
to your gamepass's ID! Set the CFrame.new(x,y,z)
on line 8 to the xyz position you want the player to be teleported to.
01 | local MarketplaceService = game:GetService( "MarketplaceService" ) |
02 | local gamepassId = 5433172 |
04 | script.Parent.Touched:Connect( function (touchedBy) |
05 | if touchedBy.Parent:FindFirstChild( "Humanoid" ) ~ = nil then |
06 | local ownsPass = MarketplaceService:UserOwnsGamePassAsync(game.Players [ touchedBy.Parent.Name ] .UserId, gamepassId) |
08 | touchedBy.Parent:MoveTo(Vector 3. new( 0 , 0 , 0 )) |
If you have issues with this, please let me know!