So I have a working morph, how do I make it so the text label above it shows the players username that is wearing the morph, and when the username removes when the player leaves the game. Help?
Here I got something for you that my help... Don't ask me why I spent my time making this. xD I didn't have enought space to make everything look clean at the website, so evereywhere I put "--Here" means you got to bind together the text at the second line. I hope you understand some stuff that is in this thing. :D
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then if hit.Parent:FindFirstChild("OverHead") == nil then local player = hit.Parent local brickOverHead = Instance.new("Part", player) local guiOverHead = Instance.new("SurfaceGui", brickOverHead) local nameOverHead = Instance.new("TextBox", guiOverHead) brickOverHead.Name = ("OverHead") brickOverHead.Anchored = true brickOverHead.Transparency = 1 brickOverHead.CanCollide = false guiOverHead.Face = ("Front") nameOverHead.Size = UDim2.new(0, 800, 0, 800) nameOverHead.BackgroundTransparency = 1 nameOverHead.Text = (player.Name) -- What you want it to say here nameOverHead.Font = ("Cartoon") nameOverHead.TextColor3 = Color3.new(255, 0, 0) nameOverHead.TextSize = 100 while true do brickOverHead.CFrame = CFrame.new(player.Torso.Position) brickOverHead.Position = -- Here hit.Parent:FindFirstChild("Head").Position -- Here + Vector3.new(0, 3, 0) brickOverHead.Rotation = player.Torso.Rotation wait() end wait(2) else end end end)
My suggestion to you is to go through all the code and figure out what's happening. :D This may help you understand more of the code and more of scripting in roblox.
I went the loooong way and made everything out of a script. The easiest way may be to make the SurfaceGUI with the text label ready and jut clone it into a character. Good luck with scripting!
~ TheWaterFoox
To find the player name you can look for the right leg to touch the morph and then use parents and child to get to the group and add .Name to revive the name of the group that is the player.
Code Below Can Get The Name:
script.Parent.Touched:connect(function(Hit) if Hit.Name == 'RightLeg' then print(Hit.Parent.Name) end end