Hi! This is a very basic question, but I'm very new to scripting. I have already assigned a variable to the person playing's name property (LocalPlayer.name), but I now want to use that to get to the player's model in the workspace. This is what I have:
local playername = game.Players.LocalPlayer.name
function teleport()
game.Workspace.playername.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(0,50,0))
end
Now, I know the issue is that I can't simply put "workspace.playername," because it looks for an object called "playername" in the workspace. If I put in my own username, the script works perfectly fine. Is there any other way that I can accomplish this using the name of the person playing?

5 comments
Wow, Thanks! Both of your answers work in-game!
Accept answer?
Sorry, I've been trying to figure out how to do that for 10 minutes XD
Do you know how to do that?
Nevermind, I figured it out. I was using firefox, and it wasn't showing me the button. I switched to Google Chrome and it came up.