Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local instances = {}
- instances.markers = {}
- local tweenService = game:GetService("TweenService")
- local module = {}
- module.initiate = function()
- local ui = Instance.new("ScreenGui")
- ui.ResetOnSpawn = false
- ui.ZIndexBehavior = Enum.ZIndexBehavior.Global
- ui.Name = "WaypointsUI"
- ui.Parent = game.Players.LocalPlayer.PlayerGui
- local Frame = Instance.new("Frame")
- Frame.Name = "Holder"
- Frame.Parent = ui
- Frame.AnchorPoint = Vector2.new(0.5, 0.5)
- Frame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- Frame.BackgroundTransparency = 1.000
- Frame.Position = UDim2.new(0.5, 0, 0.5, 0)
- Frame.Size = UDim2.new(1, -25, 1, -25)
- instances.mother = ui
- instances.holder = Frame
- instances.absSize = Frame.AbsoluteSize
- local Sample = Instance.new("ImageLabel")
- local UIAspectRatioConstraint = Instance.new("UIAspectRatioConstraint")
- local Icon = Instance.new("ImageLabel")
- local RotateLabel = Instance.new("Frame")
- local Arrow = Instance.new("ImageLabel")
- local Label = Instance.new("TextLabel")
- Label.Name = "Label"
- Label.Text = "x"
- Label.Size = UDim2.new(1,0,1,0)
- Label.BackgroundTransparency = 1
- Label.TextColor3 = Color3.fromRGB(0,0,0)
- Label.TextTransparency = 0.6
- Label.Font = Enum.Font.SourceSansSemibold
- Label.TextScaled = true
- Label.Parent = Sample
- Sample.Name = "Sample"
- Sample.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- Sample.BackgroundTransparency = 1.000
- Sample.Position = UDim2.new(0.5, 0, 0.5, 0)
- Sample.Size = UDim2.new(0.04, 0, 0.04, 0)
- Sample.Image = "rbxassetid://2681945588"
- UIAspectRatioConstraint.Parent = Sample
- Icon.Name = "Icon"
- Icon.Parent = Sample
- Icon.AnchorPoint = Vector2.new(0.5, 0.5)
- Icon.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- Icon.BackgroundTransparency = 1.000
- Icon.Position = UDim2.new(0.5, 0, 0.5, 0)
- Icon.Size = UDim2.new(1, -6, 1, -6)
- Icon.ZIndex = 2
- Icon.Image = "rbxassetid://924320031"
- Icon.Visible = false
- RotateLabel.Name = "RotateLabel"
- RotateLabel.Parent = Sample
- RotateLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- RotateLabel.BackgroundTransparency = 1.000
- RotateLabel.Size = UDim2.new(1, 0, 1, 0)
- Arrow.Name = "Arrow"
- Arrow.Parent = RotateLabel
- Arrow.AnchorPoint = Vector2.new(0.5, 1)
- Arrow.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- Arrow.BackgroundTransparency = 1.000
- Arrow.Position = UDim2.new(0.5, 0, 0, 0)
- Arrow.Size = UDim2.new(0.5, 0, 0.400000006, 0)
- Arrow.Image = "rbxassetid://2800468809"
- instances.template = Sample
- end
- local function start(marker,text)
- local part = Instance.new("Part")
- part.Anchored = true
- part.Size = Vector3.new(1,1,1)
- part.Transparency = 1
- part.CanCollide = false
- part.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame
- part.Parent = workspace
- local BillboardGui = Instance.new("BillboardGui")
- local Frame = Instance.new("Frame")
- local Label = Instance.new("TextLabel")
- BillboardGui.Parent = part
- BillboardGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
- BillboardGui.Active = true
- BillboardGui.AlwaysOnTop = true
- BillboardGui.LightInfluence = 1.000
- BillboardGui.MaxDistance = 50.000
- BillboardGui.ExtentsOffsetWorldSpace = Vector3.new(0,1.5,0)
- BillboardGui.Size = UDim2.new(8, 0, 1.25, 0)
- Frame.Parent = BillboardGui
- Frame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- Frame.BackgroundTransparency = 1.000
- Frame.BorderSizePixel = 0
- Frame.Size = UDim2.new(1, 0, 1, 0)
- Label.Name = "Label"
- Label.Parent = Frame
- Label.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- Label.BackgroundTransparency = 1.000
- Label.BorderSizePixel = 0
- Label.Position = UDim2.new(0, 0, 0.100000001, 0)
- Label.Size = UDim2.new(1, 0, 1, 0)
- Label.Font = Enum.Font.SourceSansSemibold
- Label.Text = text
- Label.TextColor3 = Color3.fromRGB(255, 255, 255)
- Label.TextScaled = true
- Label.TextSize = 14.000
- Label.TextStrokeTransparency = 0.500
- Label.TextWrapped = true
- local bottom,top = Instance.new("Part"), Instance.new("Part")
- local att0,att1 = Instance.new("Attachment"), Instance.new("Attachment")
- att0.Parent = bottom
- att1.Parent = top
- bottom.Size = Vector3.new(2,2,2)
- top.Size = Vector3.new(2,2,2)
- bottom.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame - Vector3.new(0,5000,0)
- top.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame + Vector3.new(0,5000,0)
- top.Anchored = true
- top.Transparency = 1
- top.CanCollide = false
- top.Name = "top"
- bottom.Anchored = true
- bottom.Transparency = 1
- bottom.CanCollide = false
- bottom.Orientation = Vector3.new(90, 180, 0)
- bottom.Name = "bottom"
- local beam = Instance.new("Beam")
- beam.Parent = top
- beam.Attachment0 = att0
- beam.Attachment1 = att1
- beam.FaceCamera = true
- beam.Texture = "rbxassetid://4611423139"
- beam.Color = ColorSequence.new(marker.ImageColor3)
- bottom.Parent = workspace
- top.Parent = workspace
- table.insert(instances.markers,{marker,part,true,marker.ImageColor3})
- end
- module.create = function(text,color)
- local new = instances.template:Clone()
- new.Parent = instances.mother
- new.ImageColor3 = color
- new.RotateLabel.Arrow.ImageColor3 = color
- if ((text) and typeof(text) == "string") and string.len(text) > 0 then
- new.Label.Text = string.sub(text,1,1)
- end
- new.Parent = instances.holder
- start(new,text)
- end
- coroutine.wrap(function()
- if not _G.WRan then
- _G.WRan = true
- repeat wait() until instances.mother ~= nil
- function ClampMarkerToBorder(X,Y,Absolute)
- local Screen = instances.absSize
- X = Screen.X - X
- Y = Screen.Y - Y
- local DistanceToXBorder = math.min(X,Screen.X-X)
- local DistanceToYBorder = math.min(Y,Screen.Y-Y)
- if DistanceToYBorder < DistanceToXBorder then
- if Y < (Screen.Y-Y) then
- return math.clamp(X,0,Screen.X-Absolute.X),0
- else
- return math.clamp(X,0,Screen.X-Absolute.X),Screen.Y - Absolute.Y
- end
- else
- if X < (Screen.X-X) then
- return 0,math.clamp(Y,0,Screen.Y-Absolute.Y)
- else
- return Screen.X - Absolute.X,math.clamp(Y,0,Screen.Y-Absolute.Y)
- end
- end
- end
- game:GetService("RunService").Heartbeat:Connect(function()
- for i,Stat in pairs(instances.markers) do
- local Marker = Stat[1]
- local Location = Stat[2]
- Marker.Visible = Stat[3]
- if Stat[3] then
- local MarkerPosition , MarkerVisible = game.Workspace.CurrentCamera:WorldToScreenPoint(Location.Position)
- local MarkerRotation = game.Workspace.CurrentCamera.CFrame:Inverse()*Location.CFrame
- local MarkerAbsolute = Marker.AbsoluteSize
- local MarkerPositionX = MarkerPosition.X - MarkerAbsolute.X/2
- local MarkerPositionY = MarkerPosition.Y - MarkerAbsolute.Y/2
- MarkerPositionX = MarkerPositionX-(MarkerAbsolute.X/2)
- if MarkerPosition.Z < 0 then
- MarkerPositionX,MarkerPositionY = ClampMarkerToBorder(MarkerPositionX,MarkerPositionY,MarkerAbsolute)
- else
- local Screen = instances.absSize
- if MarkerPositionX < 0 then
- MarkerPositionX = 0
- elseif MarkerPositionX > (Screen.X - MarkerAbsolute.X) then
- MarkerPositionX = Screen.X - MarkerAbsolute.X
- end
- if MarkerPositionY < 0 then
- MarkerPositionY = 0
- elseif MarkerPositionY > (Screen.Y - MarkerAbsolute.Y) then
- MarkerPositionY = Screen.Y - MarkerAbsolute.Y
- end
- end
- Marker.RotateLabel.Visible = not MarkerVisible
- Marker.RotateLabel.Rotation = 90 + math.deg(math.atan2(MarkerRotation.Z,MarkerRotation.X))
- Marker.Position = UDim2.new(0,MarkerPositionX,0,MarkerPositionY)
- tweenService:Create(Marker,TweenInfo.new(.5),{ImageColor3 = Stat[4]}):Play()
- tweenService:Create(Marker.RotateLabel.Arrow,TweenInfo.new(.5),{ImageColor3 = Stat[4]}):Play()
- end
- end
- end)
- end
- end)()
- _G.waypointsLibSource = module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement