Advertisement
ColdSpecs

Untitled

Sep 24th, 2023
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. local Camera = workspace.CurrentCamera
  2. local DrawingAPI = {}
  3.  
  4. local function GetHead(Model)
  5. return Model:FindFirstChild("Head")
  6. end
  7.  
  8. -- Create a text object for the HandModel only
  9. local HandModel = workspace.Model:FindFirstChild("HandModel") -- Get the HandModel from the Model group in the workspace
  10. if HandModel then -- If the HandModel exists
  11. local Head = GetHead(HandModel) -- Get the head of the HandModel
  12. if Head then -- If the head exists
  13. DrawingAPI[HandModel] = Drawing.new("Text") -- Create a new text object
  14. DrawingAPI[HandModel].Visible = false -- Set the visibility to false initially
  15. DrawingAPI[HandModel].Size = 20 -- Set the size to 20
  16. DrawingAPI[HandModel].Center = true -- Set the center to true
  17. DrawingAPI[HandModel].Outline = true -- Set the outline to true
  18. DrawingAPI[HandModel].OutlineColor = Color3.new(0, 0, 0) -- Set the outline color to black
  19. end
  20. end
  21.  
  22. -- Update the text object every frame
  23. game:GetService("RunService").RenderStepped:Connect(function()
  24. local ScreenPosition, OnScreen = Camera:WorldToScreenPoint(Head.Position) -- Convert the head position to screen position and check if it is visible
  25. if OnScreen then -- If the HandModel is visible on the screen
  26. DrawingAPI[HandModel].Visible = true -- Set the text visibility to true
  27. DrawingAPI[HandModel].Position = Vector2.new(ScreenPosition.X, ScreenPosition.Y - 50) -- Set the text position above the HandModel's head
  28. DrawingAPI[HandModel].Text = "Cow" -- Set the text content to "Cow"
  29. DrawingAPI[HandModel].Color = Color3.new(1, 1, 1) -- Set the color to white
  30. else -- If the HandModel is not visible on the screen
  31. DrawingAPI[HandModel].Visible = false -- Set the text visibility to false
  32. end
  33. end)
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement