first of sorry if the title is weird didn't really know what to call it so I've got this code here that when the player clicks on the part the player is teleported to somewhere on the map facing a certain direction my problem is i want to do that but not when the player clicks the part but when called on like for example if the player press e. I've been told to just take it out of the loop but that's the problem the loop connects and define Player and i cant take it out without redefining Player which i don't know how to do and is what i'm asking help for. i will happily ask any questions.
here is the code:
game.Workspace.Hello.ClickDetector.MouseClick:Connect(function(Player)
local CharacterModel = Player.Character
CharacterModel:SetPrimaryPartCFrame(CFrame.new(1, 0, 1) * CFrame.Angles(math.rad(0), math.rad(80), math.rad(0)))
end)

2 comments
ok
thank you for this it did not work but it was the cframe bringing up problems now so in other words you helped me thanks!