So, i’m trying to do this teleport script that has a determined range to where you can teleport to, but when you put your mouse far away and execute the teleport script it stops working, you wait the cooldown but it still doesn’t work, any help?
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 = 1
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:DistanceFromCharacter(Mouse.Hit.p) <= 75 then
Player.Character:MoveTo(Mouse.Hit.p)
end
end
end
end
end)
TimeSkip.OnClientEvent:Connect(function()
wait(cooldown)
debounce = false
end)