Making a system so players can only move when they’re not seen and will freeze once they’re seen by any other player. I’ve managed to set up the detection aspect of the script, so I know when players are and when they aren’t being observed, however I’m running into problems with making the players actually freeze when they can be seen, and allowing them to move when they aren’t. I’ve simply tried anchoring them and unanchoring them on the server, however there’s a brief moment when you can actually see them walking (due to the client-server delay in the detection script). How can I make it so the player can’t be seen moving for a brief moment before being frozen after they’re observed and make it seem as if the player teleports to their new location instead?
There’s not much you can do about client-server delay besides minimizing the lines of code that runs before the anchoring on the server. Instead of anchoring, you could set the humanoid’s WalkSpeed and JumpPower properties to 0, which should work beter. However, usually client-server delay is very minimal, and typically won’t make a large impact on functionality like this. As aforementioned, definitely try to set the WalkSpeed and JumpPower properties to 0 as soon as the server is fired to minimize client-server delay.
There isn’t any scripts here to work with. This will most likely need a remote sever/client set up.
I would have tried anchoring too but, you seem to be have issues with that also.
To lock them in place maybe try …
if isSeen then
freezePosition = humanoidRootPart.Position
else
freezePosition = nil
end
local function onDetectionChanged(isSeen)
if isSeen then
freezePosition = humanoidRootPart.Position
end
end
runService.RenderStepped:Connect(function()
if freezePosition then
humanoidRootPart.CFrame = CFrame.new(freezePosition)
end
end)
This is not a script … more of a list of snips. Setting up the logic to script.