In the future please use code blocks, its the blue circle at the top which you can click
there is alot of things wrongs with your code, ill go through them 1 by 1
local debounce = true
local target = game.Workspace:WaitForChild("MyPlayerName")
script.Parent.MouseButton1Click:connect(function()
if debounce == true then
enddebounce = false
player.Character.HumaniodRootPart.CFrame = target.CFrame * CFrame.new(170.26, 402.762, 190.15)
First, your WaitForChild is actually waiting for a player named "MyPlayerName", but that player definitely isnt you, so its stuck at that line forever and cant go on, if you open the output view you will see the game tells you that infiniteyield possible on WaitForChild, and thats because it is going to be waiting for that imaginary "MyplayerName" forever, so put your Player Name instead like this
local player = script.Parent.Parent.Parent.Parent
local target = game.Workspace:WaitForChild(player.Name)
Ok so thats fixed, your second problem is where you didnt set the debounce to false correctly
if debounce == true then
debounce = false
Third problem, your HumanoidRootPart is named incorrectly, check the spelling
Fourth problem, target is your player object in the workspace, if you use target.CFrame it will throw an error saying CFrame not a member of target, thats because target is talking about the whole player's model in the workspace, use target.HumanoidRootPart.CFrame instead as you want the CFrame of his body parts.
target.HumanoidRootPart.CFrame * CFrame.new(170.26, 402.762, 190.15)
Alright last problem(finally), you didnt end your functions and if statement
script.Parent.MouseButton1Click:Connect(function()
if debounce == true then
end
end)
This may be abit long but more problems = longer answer, when you get the code to work, please accept this answer :) it took me awhile to write, and other people can learn from it too
2 comments
This should do, Also you should use :Connect because :connect is deprecated.
ah didnt notice that because i just copied the code, ill edit it