A script for the script.got the teleporting down but may teleport too far
local remote = game.ReplicatedStorage:WaitForChild("telemote")
remote.OnServerEvent:Connect(function(plr,mousehit)
local char = plr.Character or plr.CharacterAdded:Wait()
local position = mousehit.p
char.HumanoidRootPart.CFrame = position ----I want it with in 20 studs though...…./

4 comments
Transform mousehit.p into a vector, subtract it from the player's position, and get the magnitude of the resulting vector. If the magnitude is > 20, then don't teleport.
How do I make it a vector?
mousehit.P would be a Vector3 instance
the position of the actual mouse cursor is a Vector2 instance