I am wondering how I can get my teleporters to only teleport a player only when they step off of the teleporter and step back onto it using debounce, instead of being teleported onto the other teleporter and then teleported right back.
local assetID = 870836117
local debounce = false
local pad = script.Parent.Parent.Parent.TeleB.Pad
local function OwnsShades(Hit)
if debounce == false then
debounce = true
local plr = game.Players:GetPlayerFromCharacter(Hit.Parent)
if plr then
if game:GetService("MarketplaceService"):PlayerOwnsAsset(plr,assetID) then
print(plr.Name .. " owns the Midnight Shades")
Hit.Parent:MoveTo(pad.Position)
else
print(plr.Name .. " doesn't own the shades")
game:GetService("MarketplaceService"):PromptPurchase(plr, assetID)
end
wait(1)
debounce = false
end
end
end
script.Parent.Touched:Connect(OwnsShades)

1 comment
If I am understanding correctly, you would use magnitude property to check the distance from the player to the teleport pad or whatever. Use repeat wait loop until the distance is greater than desired amount.