How do i localize getdistancefromcharacter

I’m trying to make my teleport script not teleport you when you point a distance over 100 studs with your mouse but it says that “GetDistanceFromCharacter” is not a valid member of “Player” how do i fix this? Script is below:

local Player = game:GetService(“Players”).LocalPlayer
local Mouse = Player:GetMouse()

local rp = game:GetService(“ReplicatedStorage”)
local TimeSkip = rp:WaitForChild(“TheWorldRemotes”):WaitForChild(“TimeSkip”)

local UIS = game:GetService(“UserInputService”)

local debounce = false
local cooldown = 5

UIS.InputBegan:Connect(function(input,isTyping)
if isTyping then
return
elseif input.KeyCode == Enum.KeyCode.X then
if workspace:FindFirstChild(Player.Name…" Stand") then
if debounce == false then
debounce = true

	            TimeSkip:FireServer()
	if Player:GetDistanceFromCharacter(Mouse.Hit.p) <= 100 then
Player.Character:MoveTo(Mouse.Hit.p)

end

	    end
	end
end

end)
TimeSkip.OnClientEvent:Connect(function()
wait(cooldown)
debounce = false
end)

You have the wrong name of the function, the function is actually called DistanceFromCharacter

2 Likes