Help With My Anti-Teleport Script

Hey There! I Am Making a Anti-Teleport For My Game.
It Works Fine But The Problem Is When The Player Dies And Gets To The Spawn The Anti-Teleport Puts The Player Back To Where They Died, Because It Thinks The Player Teleported, So I Put a Prevention To Check The Players Is Dead Or Not. But It Still Not Really Efficient.

Here Is a Video From My Tester:


So Here Is My Code:

local lastLocations = {}
while true do
	wait()
	if Player.Character then
		local Torso = Player.Character:FindFirstChild("Torso")
		if (Torso) then
			local Character = Player.Character
			if lastLocations[Player] then
				if Player:DistanceFromCharacter(lastLocations[Player].Position) >= 20 then
					if not Player.Character.Humanoid:GetState() == Enum.HumanoidStateType.Dead then -- Checks The Player's Character Is Dead Or Not
						print("Player Teleported.")
						Character:SetPrimaryPartCFrame(lastLocations[Player])
					end
				end
				lastLocations[Player] = Character.PrimaryPart.CFrame
			else
				lastLocations[Player] = Character.PrimaryPart.CFrame
			end	
		end
	end
end

How Can I Make It More Efficient?

2 Likes

Just add in something like this. What this does is it stops the script running while the player is dead and resumes when the new character is added. The events automatically disconnect when the player Leaves to prevent it from clogging memory.

local Players
local PlayerEvent
local CharacterEvent
PlayerEvent = Game.Players.PlayerAdded:Connect(PlayerAdd(Player))


function PlayerAdd (Player)
    CharacterEvent = Player.CharacterAdded:Connect(CharAdd(Character,Player))
end)

function CheckForPlayer(Player)
    Players = Game.Players:GetPlayers()
    if Players[Player] == nil then
       PlayerEvent:Disconnect()
       CharacterEvent:Disconnect()
    else
        return true
    end
end

function CharAdd (Character,Player)
    while true do
        if Character.Humanoid.Health > 0 and CheckForPlayer(Player) == true then
        -- Your script
        else
            CheckForPlayer(Player) -- To Disconnect
            break
        end
    end
end)
1 Like

The Script Is On The Client Side, But Thanks For Your Response.

Move it server side. If there is a hacker they can delete local scripts rendering everything you coded useless. They cant touch the server scripts.

The other thing they could do is alter the clients memory to change the value of variables in local scripts, this means they could erase or even change the data to tp themselves using your own code.

Not only that but having it server side means you can use datastores and kick players and whatnot

1 Like

When the player dies. Just remove its last locations. Implement its new location basied on the spawn point.

If the script is on the client. You might as well delete it. A hacker will just delete the script if they wanted to teleport; Instead put it on the server where a hacker cannot delete it.

2 Likes

Hey am not sure about exploits, but won’t the hacker need the exact name of the local script to delete it?

Alright, Thanks For Your Feedback!

Nah they could just do

game.Players.PlayerScripts.AntiTeleportScript:Destroy()

If you mean the full name, Yeah they need that but they can easily get that through applications like Dex. Which basically allows them to view workspace, Player gui and even view your scripts. So they’ll see the name and the scripts content lol.

1 Like

smh, sorry but “AntiTeleportScript” is the name of the script so i can just change the name of my local script to “thescriptthathackerscantfind” and now your statement would be false.

as for dex idk how it works but am pretty sure u can’t view the scripts of a roblox game.
as far as i know IF that was possible then most of the games would be already hacked cause many roblox games use remote events and functions.

(Just stating what i know, sorry if am wrong.)

A hackerman cannot view a server script. They can view modules, And Local scripts. Also yes my script could be false. But then the hacker will just change the code to delete ur script again. This is how exploiting works. Its a fight of 2 people. 1 hack, 2 dev

Here. Look at this video for DeX

1 Like

i think u didn’t notice that he’s using a script builder, which is probably his own script.
he is using this in his own game. I believe that its not an exploit

An exploit is a way to execute scripts inside a game. So a hacker will execute that DeX Script inside of a 3rd party game. Hence getting access to those games… No you do not get server side access, Unless a developer has given you permissions. But you will have access to visualize all elements in workspace and various other locations.

He didn’t make DeX. Raspberry Pi and a few others did. Or kept developing on it.

They can see everything that is on the client.

They use a explorer, I wont reveal the name of it for security reasons and T&Cs. This explorer shows everything in the client and all replicated parts and some server scripts depending on where you put them(They cant stop them running).

It looks a lot like your explorer but it shows all hidden services and can effect memory too.

The exploits themselves come with built in functions, the main site ive seen uses aimbot xray, fly, infinite jump, speed and teleportation.

They also allow you to run your own lua code which is where people try to abuse your modules and stuff. Memory editing is usually paid scripts but DEX itself is not a threat, all it does is let them see what’s on the client, it doesn’t let them bypass any server sided security.

Most changes only occur on the client so keeping all your security server sided is a good idea. This security should not be connected to any modules or remotes to prevent any information coming in from the client, this way they cannot break your anti.

As for what I’ve seen Roblox has been trying very hard to prevent exploiters recently and all of the exploits are waiting on API updates to their core exploit software which they get from someone else. You just need to make sure they cant do anything to interrupt other peoples games or do anything too overpowered, Its near impossible for you yourself to patch every single exploit so just cover the most game breaking first.

Exploits are general executable that edit the memory to create a memory pipe into your roblox process. From there editing the engine and creating bypasses for any Roblox-AntiCheat they can produce. You can’t block DLL Injections because applications like discord do the same method. But instead they do it to help display what game you’re playing and what you’re doing on it.

DeX was never a threat. Same as any hacker. But in terms of “Scripts” and code which will cause alot of damage towards a game. Yes DeX is a tool that’ll help you view client modules, scripts. Help you Change and modify client variables, It’ll even let you fire custom remotes with arguments you want.

When creating an AntiCheat. It is best to keep it on the server 100% But sometimes you cannot dp that. There are things that you cannot detect. Or stability reasons. Such as HumanoidStateChanged. It isn’t stable on the serer but it is stable on the Client, This is because of performance. Either way, A client can modify your remote messages before they even get to a script. So trying to hide information is a waste. A hacker will simply just hijack that message and change it to what they want to change it too behind your back. Hence you scripts cannot detect it; Or so I’ve yet to see.

Also most exploits yes, The free ones work on other Libaries which do all the hard work for you. But applications like Synapse X is more a less a premium exploit that will update relatively quickly. It isn’t because of security. I believe its just down to how roblox runs and updates itself. But i’m not 100% sure on that. Either way it’s gotten to the point where hackers create robots to extarct the required data from the application itself. So calling that a good method of protection wouldn’t be advised.

It’s hard to patch every exploit. Even harder to make it dynamic to any game. But it is my motivation and my goal to break what challenges their are. I’ve seen and done things that 90% of the developer community didn’t think was possible. And because i’ve done this; I do see that there are ways of detection and I do see that you just have to be creative and think up new ways.

Also, About the Server Security. Nothing can effect that; Period. Unless you or someone who can access the same game/universe as you has got an infected plugin. Hence the plugin will infect you game and allow the hacker to execute server sided commands. Then it can be an Issue. But these issues can be resolved by removing the remote and any scripts it has brought into the game. In my terms, Search for “require” or the Bytes linked to it; Then search up various other terms that’ll link you to the module/scripts.