Hello everyone. We have encountered a problem, ;to and ;bring commands conflict with teleports on the map.
And yes, I am sure that it’s teleports who break TP commands, we already tested that by removing Teleport Manager from Server Script Service.
In short, every time when I try to use ;to or ;bring commands, me or player just gets teleported into some random place, I did not find anything in common with broken TP position. BUT if am close to the player, like 5 studs or so, I get teleported without any issues. We already tried to put script into the teleports itself, it didn’t helped.
Anyone know the cause of that?
Script:
-- Locals.
local CollectionService = game:GetService("CollectionService")
local WaitTime = 1
local Teleporters = workspace:FindFirstChild("Teleporters")
local Cooldown = 2
-- Set up function for each teleporter.
local function Initialize(Hitbox)
-- Set up Debounce.
local Debounce = Instance.new("BoolValue",Hitbox)
Debounce.Name = 'Debounce'
Debounce.Value = false
-- Set up what happens when teleporter is touched.
Hitbox.Touched:Connect(function(Object)
-- Check if debounce is enabled.
if Debounce.Value then return end
Debounce.Value = true
print('Firing Teleport')
-- Check if is a person
local Humanoid = Object.Parent:FindFirstChild('Humanoid')
local HumanoidRootPart = Object.Parent:FindFirstChild('HumanoidRootPart')
if not Humanoid then
-- Cancelling teleport so teleporter doesn't break.
Debounce.Value = false
warn('Checked for Humanoid. Humanoid not found. Cancelling Teleport.')
return
else
print('Humanoid Found. Resuming Teleport.')
wait(WaitTime)
local Other = nil
-- Discover destination and teleport player there.
if string.find(Hitbox.Name, '1') then
local Part1 = string.gsub(Hitbox.Name, "1", "")
local Part2 = Teleporters:FindFirstChild(Part1..'2')
Part2:FindFirstChild('Debounce').Value = true
Other = Part2:FindFirstChild('Debounce')
HumanoidRootPart.Position = Part2.Position
elseif string.find(Hitbox.Name, '2') then
local Part1 = string.gsub(Hitbox.Name, "2", "")
local Part2 = Teleporters:FindFirstChild(Part1..'1')
Part2:FindFirstChild('Debounce').Value = true
Other = Part2:FindFirstChild('Debounce')
HumanoidRootPart.Position = Part2.Position
end
wait(Cooldown)
-- Set up for next .Touched event.
Debounce.Value = false
Other.Value = false
end
end)
end
-- Ready up each teleporter
for _,Teleporter in pairs(CollectionService:GetTagged("Teleporter")) do
Initialize(Teleporter)
end
-- Ready up new teleporters
CollectionService:GetInstanceAddedSignal("Teleporter"):Connect(Initialize)