Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Camera = workspace.CurrentCamera
- local DrawingAPI = {}
- local function GetHead(Model)
- return Model:FindFirstChild("Head")
- end
- -- Create a text object for the HandModel only
- local HandModel = workspace.Model:FindFirstChild("HandModel") -- Get the HandModel from the Model group in the workspace
- if HandModel then -- If the HandModel exists
- local Head = GetHead(HandModel) -- Get the head of the HandModel
- if Head then -- If the head exists
- DrawingAPI[HandModel] = Drawing.new("Text") -- Create a new text object
- DrawingAPI[HandModel].Visible = false -- Set the visibility to false initially
- DrawingAPI[HandModel].Size = 20 -- Set the size to 20
- DrawingAPI[HandModel].Center = true -- Set the center to true
- DrawingAPI[HandModel].Outline = true -- Set the outline to true
- DrawingAPI[HandModel].OutlineColor = Color3.new(0, 0, 0) -- Set the outline color to black
- end
- end
- -- Update the text object every frame
- game:GetService("RunService").RenderStepped:Connect(function()
- local ScreenPosition, OnScreen = Camera:WorldToScreenPoint(Head.Position) -- Convert the head position to screen position and check if it is visible
- if OnScreen then -- If the HandModel is visible on the screen
- DrawingAPI[HandModel].Visible = true -- Set the text visibility to true
- DrawingAPI[HandModel].Position = Vector2.new(ScreenPosition.X, ScreenPosition.Y - 50) -- Set the text position above the HandModel's head
- DrawingAPI[HandModel].Text = "Cow" -- Set the text content to "Cow"
- DrawingAPI[HandModel].Color = Color3.new(1, 1, 1) -- Set the color to white
- else -- If the HandModel is not visible on the screen
- DrawingAPI[HandModel].Visible = false -- Set the text visibility to false
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement