Recently I've been messing around with GUI Buttons in scripting and decided to do a random teleport. I had another place where I was working on but decided to open a new studio instance and play around with it. The teleport worked but now it isn't. How do I fix it?
It says Torso is not a part of the Model and I don't now what it exactly means.
local screenGui = Instance.new("ScreenGui")
screenGui.Parent = script.Parent
local textButton = Instance.new("TextButton")
textButton.Parent = screenGui
textButton.Position = UDim2.new(0, 25, 0, 300)
textButton.Size = UDim2.new(0, 150, 0, 50)
textButton.BackgroundColor3 = BrickColor.White().Color
textButton.Text = "Random Teleport"
textButton.MouseButton1Down:Connect(function()
game:GetService('UserInputService')
game.Players.LocalPlayer.Character.Torso.CFrame = CFrame.new(Vector3.new(Random, Random, Random))
textButton.Visible = false
end)

5 comments
i dont think connect is capitalized
it worked with it being capitalized on the other place
The error pretty much tells you everything. “Torso” doesn’t exist in the player’s character. Your script should work with R6 characters only, but if you’re using R15 too, use HumanoidRootPart instead.
also, this isnt FE compatable
Are you using R15 rig or R6? The errors tells yoy it cant find anything named Torso. The model is the player model in Workspace when you play. If your rig is R15 there are "UpperTorso"&"LowerTorso". R6 has just Torso.