I thought about starting to create an Anti-Teleport system in my game and, so far, it is working well. I had to adapt it a lot, since my game has a teleport player system (inside the map) So far it has worked well and without any problems, however I'm testing at RobloxStudio, where I don't have the real experience of a player playing and I'm also concerned with pinging the players, after all, it can hinder this Anti-system Teleport?
first script, it creates a "StringValue" in ServerScriptService (a safe place and out of reach of Exploiters) with the name of the player when he enters. In this String Value, my idea was that I could change its Value (in this case, its Text) depending on the situation in which the player was, for example, if he was playing normally on the map (without touching any teleporter) his text would be: "World" and, if he touches a teleporter, the text would be: "Teleport" to indicate that, the reason he has if he moved from one point to another it was because he teleported with a legal Teleport server system.
coroutine.resume(coroutine.create(function()
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Wait()
local value = game.ServerScriptService:FindFirstChild(player.Name).Value
local character = player.Character
coroutine.resume(coroutine.create(function()
workspace.Part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name == player.Name then
game.ServerScriptService:FindFirstChild(hit.Parent.Name).Value = "Teleport to"
end
end)
end))
right after, I added parameters to the script: I asked him to check (1 in 1 second) the distance between an old position of this player and a new one. If it was greater than a certain value, the script would check to see what was the reason for the high magnitude .
coroutine.resume(coroutine.create(function()
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Wait()
--touchedrec = false
local value = game.ServerScriptService:FindFirstChild(player.Name).Value
local character = player.Character
coroutine.resume(coroutine.create(function()
workspace.Part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
game.ServerScriptService:FindFirstChild(hit.Parent.Name).Value = "Teleport to"
end
end)
end))
coroutine.resume(coroutine.create(function()
player.Character.Humanoid.Died:Connect(function()
player.CharacterAdded:Connect(function()
character = player.Character
end)
end)
end))
while wait() do
if player.Character:FindFirstChild("HumanoidRootPart") then
local pos1x = player.Character.HumanoidRootPart.Position.X
local pos1z = player.Character.HumanoidRootPart.Position.Z
local pos1 = Vector3.new(pos1x,0,pos1z)
wait(1)
if player.Character:FindFirstChild("HumanoidRootPart") then
local pos2x = player.Character.HumanoidRootPart.Position.X
local pos2z = player.Character.HumanoidRootPart.Position.Z
local pos2 = Vector3.new(pos2x,0,pos2z)
--print((pos1 - pos2).magnitude)
local mag = (pos1 - pos2).magnitude
if mag > 40 then
if character.Humanoid.Health > 0 then
if value == "Teleport" then
print("okay, his magnitude is high because he touched a teleporter")
elseif game.ServerScriptService:FindFirstChild(player.Name).Value == "World" then
print("Kicking player...")
end
end
end
end
end
end
end)
end))
my doubt is: can ping hinder this system? (there are more scripts involving this system, but I think the question would be too big (if it hasn't already)) If so, how would I adapt my script to ping each player?
another question: whenever someone enters, will they create a role for each player? to measure the magnitude of everyone?
