repeat wait() until game.Players.LocalPlayer.Character

-- // Scripted by Seth // --

local plr = game.Players.LocalPlayer
local MyBody = plr.Character
local mouse = plr:GetMouse()

script.Parent.Activated:connect(function()
	local hit = mouse.Hit
	MyBody:MoveTo(hit.p)
end)

now i already tried something but it didn't work here is what tried

repeat wait() until game.Players.LocalPlayer.Character

local Player = game:GetService("Players").LocalPlayer

local rp = game:GetService("ReplicatedStorage")

local TimeSkip = rp:WaitForChild("Stand6Remotes"):WaitForChild("TimeSkip")
local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local MyBody = plr.Character
local mouse = plr:GetMouse()
local hit = mouse.Hit
	
local debounce = false
local cooldown = 10

UIS.InputBegan:Connect(function(input,IsTyping)
	if IsTyping then
		return
	elseif input.KeyCode == Enum.KeyCode.C then
		
		if workspace:FindFirstChild(Player.Name.." sumthing") then
			if debounce == false then
				debounce = true
				
				TimeSkip:FireServer()
				
				MyBody:MoveTo(hit.p)
				
				wait(cooldown)
				debounce = false
			end
		end
		
	end
end)

i would appreciate the help