Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local DrawingAPI = {}
- local reallyRed = Color3.fromRGB (255, 0, 0)
- local limeGreen = Color3.fromRGB (9, 194, 0)
- local function GetState (model)
- for _, part in pairs (model:GetChildren ()) do
- if part.Name == "State" then
- return part
- end
- end
- end
- local function CreateTextLabel (model)
- DrawingAPI [model] = Drawing.new ("Text")
- DrawingAPI [model].Visible = false
- DrawingAPI [model].Size = 20
- DrawingAPI [model].Color = Color3.new (1, 1, 1)
- DrawingAPI [model].Center = true
- DrawingAPI [model].Outline = true
- end
- local function CreateCircleLogo (model)
- DrawingAPI [model] = Drawing.new ("Circle")
- DrawingAPI [model].Visible = false
- DrawingAPI [model].Radius = 10
- DrawingAPI [model].Color = Color3.new (0, 0, 1)
- DrawingAPI [model].Filled = true
- end
- local function UpdateDrawingObjects ()
- for _, model in pairs (workspace:GetChildren ()) do
- if model:IsA ("Model") and model ~= game.Players.LocalPlayer.Character then
- local state = GetState (model)
- if state and (state.Color == reallyRed or state.Color == limeGreen) then
- if not DrawingAPI [model] then
- if state.Color == reallyRed then
- CreateTextLabel (model)
- elseif state.Color == limeGreen then
- CreateCircleLogo (model)
- end
- end
- else
- if DrawingAPI [model] then
- DrawingAPI [model]:Remove ()
- DrawingAPI [model] = nil
- end
- end
- end
- end
- end
- local function DrawDrawingObjects ()
- local camera = workspace.CurrentCamera
- local cameraPos = camera.CFrame.p
- for model, drawingObject in pairs (DrawingAPI) do
- local screenPos, onScreen = camera:WorldToScreenPoint (model.PrimaryPart.Position)
- if onScreen then
- drawingObject.Visible = true
- drawingObject.Position = Vector2.new (screenPos.X, screenPos.Y)
- if drawingObject.ClassName == "Text" then
- drawingObject.Text = "Decaying"
- end
- else
- drawingObject.Visible = false
- end
- end
- end
- game:GetService ("RunService").RenderStepped:Connect (function ()
- UpdateDrawingObjects ()
- DrawDrawingObjects ()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement