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

How can my teleport script detect private places?

Asked by
Rukreep 15
3 years ago

Basically, once the players touch thhis part, it will teleport them to a random place. Problem is, that most of the time the places are invalid or closed. So, how can I make it so that if the math.random place is considered a valid place?

Script:

local telePart = script.Parent
local TeleportService = game:GetService('TeleportService')

while wait(5) do
local function otherGame(otherPart)
    local placeID = game.Workspace.PlaceValue.Value
 local player = game.Players:FindFirstChild(otherPart.Parent.Name)

 if player  then


local placetp =   TeleportService:Teleport(placeID, player)

 end

end

telePart.Touched:Connect(otherGame)

end

Answer this question