You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to make the player when they click the text button it teleports them to a specific location using vector 3 or Cframe
What is the issue? Include screenshots / videos if possible!
The issue is how do you get the humanoid root part from a mouse click.
What solutions have you tried so far? Did you look for solutions on the Developer Hub
i have tried looking it up but I had no luck.
You can teleport on the client, so you know the local player is Players.LocalPlayer, from there get the Character then the PrimaryPart, which is the humanoid root part.
incapaz was saying that you can do this entirely on the Client without needing RemoteEvents. From my understanding, this is because when a Client has Network Ownership over something (which in this case is their Character), the physics of that Instance will be calculated on the Client.
local Players = game:GetService("Players") -- References Players service
local player = Players.LocalPlayer -- References the LocalPlayer/the Client that has this LocalScript
local Character = player.Character or player.CharacterAdded:Wait() -- References the player's Character or waits for it to load into the game
local TextButton = script.Parent -- References the TextButton as "script.Parent"/the instance containing the LocalScript
TextButton.Activated:Connect(function() -- Whenever the button is clicked, it'll activate a function
if Character and Character.PrimaryPart then -- If the Character exists and it has a PrimaryPart
Character:SetPrimaryPartCFrame(CFrame.new(X,Y,Z)) -- Change X,Y, and Z to the new coordinates
--[[ We can then teleport the Character to a new location
by setting the CFrame of its PrimaryPart to new coordinates,
as defined by X, Y, and Z --]]
end -- Ends the "if Character and Character.PrimaryPart then" statement
end) -- Ends the TextButton.Activated function