I've tried lots of scripts but I'm an imbecile.
COMMUNITY QUESTION
How do I make it so that if I press a button I can teleport to my mouse location?
2 answers
Create a click event, upon firing change the CFrame of the client's HumanoidRootPart to the client's Mouse.Hit
local player = game.Players.LocalPlayer local Character = player.Character or player.CharacterAdded:Wait() local Mouse = player:GetMouse() local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(Key) if Key.KeyCode == Enum.KeyCode.T then Character:SetPrimaryPartCFrame(Mouse.Hit) end end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
He said whenever one clicks a button though.
Exactly, that's why I said "Create a click event".
Click events only works for mouse events. With UserInputService you can use all other keyboards buttons as well as the mouse.He didn't specify mouse button so I like to keep the options open.