✓ Accepted answer
A problem with your code was that you compared a string to an object found (or not found) in game.Workspace so I just made it so that if the object exists then proceed. Also you can't use properties as variables unless you want the current value rather than the value as it changes.
From there you should get the players character, rather than setting the torso CFrame. I'm not quite sure why you want to do script.Parent.Parent.Parent:Destroy() but I'm assuming you want to keep that. This should only teleport if the player's character is present and the humanoid exists and is alive. If you encounter any glitches comment on here so I can figure them out.
b = script.Parent.Parent.name
function transport()
local player = game.Players:FindFirstChild(b.Text)
if player and player.Character then
local character = player.Character
if character:FindFirstChild("Humanoid") and character.Humanoid.Health > 0 then
character:MoveTo(game.Workspace.planetbeam.Position + Vector3.new(0,5,0))
script.Parent.Parent.Parent.Parent:Destroy()
end
end
end
script.Parent.MouseButton1Click:connect(transport)
NOTE: You shouldn't really use "name" as the name of the text box because that could cause problems. It might not but either way it's bad practice because it could read it as the Name property of script.Parent.Parent, rather than the text box
4 comments
Are you trying to teleport other players or to teleport a certain player to a part
Like do you want a button saying "Player 2" and it teleports player2 to that part OR do you want it to say "Platform 3" and it teleports you there..
What happens is someone types in a name in the TextBox and presses the button, and it's meant to teleport the player that has been typed in
Alright