Hello there, I am sort of new here, and I hope you can understand my problem.
With my script, I would like to clone a SurfaceGUI into the UpperTorso part of every player character inside the game. After running the script, it does not throw any errors, however, the SurfaceGUI fails to show up on the UpperTorso, and the object I want to clone does not show up in the player's UpperTorso in the Explorer, either. I have also tried cloning other types of objects into the UpperTorso too, and they do not seem to get cloned, either. I have also read about how SurfaceGUIs need an Adornee, it would be great if someone explained that, too.
My script is:
local Players = game:GetService("Players") Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) local uppert = character.UpperTorso if uppert then local that = script.BackNumber:Clone() that.Parent = uppert end end) end)
The BackNumber SurfaceGUI object is in the Script itself, and it has a TextLabel inside it.
Thanks in advance for the help.
In terms of the SurfacGui you'll need to make sure you set the adornee and face to where you want. Judging from your script you want it on the back.
local players = game:GetService("Players") players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) local uppert = character.UpperTorso if uppert then local that = script.BackNumber:Clone() that.Adornee = uppert --Sets the gui to show up on the upper torso that.Face = "Back" --Sets the gui to show up on the back of the upper torso that.Parent = uppert end end) end)
Now in terms of parts in case you're unsure, you need to make sure that you're setting the CFrame of the cloned part to that of the part you want it to be attached to and then use a weld constraint once it's positioned how you want. All you'll really have to do for the weld is set it's Part0 and Part1 to the 2 parts