✓ Accepted answer
Okay so it seems like you are new to coding, let me recommend you this site.
I assume that the object is the TextButton and I also assume that the Activated event actually triggers (you can confirm that by putting something like print("hi") in the function)
Now, you should never ever teleport a player with a localscript. Use a RemoteEvent.
I will be nice and give you the code you need this time
So put a remoteevent in ReplicatedStorage and call it teleport.
In the onActivated function you would fire that event by game.ReplicatedStorage.teleport:FireServer(). (In case you're wondering, you don't have to pass the localplayer variable in the function because it automatically does that for you.) Then, you need a Script. Put it in the serverscriptservice. In that script, you will need to listen for the event so you can teleport the player. This is a nice little way of handling events without creating extra functions for them:
game.ReplicatedStorage.teleport.OnServerEvent(function(player)
player.Character.HumanoidRootPart.CFrame = workspace.object.Position+CFrame.new(0,5,0)
end)
Now obviously you have to replace workspace.object.Position with the object/coordinates you want to teleport your player to/at.
1 comment
Are you trying to teleport in Studio? You can't teleport to another place in Studio but it should tell that in your output but if you wanted to test the actual teleportation out you would have to actually play the game with Roblox Player