Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local radarBG = script.Parent:WaitForChild("Background")
- local playerDotTemplate = game.ReplicatedStorage:WaitForChild("PlayerDot")
- local plr = game.Players.LocalPlayer
- local char = plr.Character or plr.CharacterAdded:Wait()
- game:GetService("RunService").RenderStepped:Connect(function()
- radarBG:ClearAllChildren()
- local uiAspectRatioConstraint = Instance.new("UIAspectRatioConstraint", radarBG)
- for i, otherPlayer in pairs(game.Players:GetPlayers()) do
- local otherChar = otherPlayer.Character
- if otherPlayer ~= plr then
- if otherChar and otherChar:FindFirstChild("HumanoidRootPart") and char:FindFirstChild("HumanoidRootPart") then
- local playerDot = playerDotTemplate:Clone()
- local offset = otherChar.HumanoidRootPart.Position - char.HumanoidRootPart.Position
- local distance = 1/200
- offset = offset * distance
- playerDot.Position = UDim2.new(offset.X + 0.5, 0, offset.Z + 0.5, 0)
- playerDot.Parent = radarBG
- end
- else
- local playerDot = playerDotTemplate:Clone()
- playerDot.Position = UDim2.new(0.5, 0, 0.5, 0)
- playerDot.Parent = radarBG
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement