roblox mini map
local screenGui = script.Parent
local minimapFrame = screenGui:WaitForChild("Minimap")
local localplayer = minimapFrame:WaitForChild("LocalPlayerLocation")
local VehicleLocation = minimapFrame:WaitForChild("VehicleLocation")
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart")
local humanoid = char:WaitForChild("Humanoid")
local currentCamera = Instance.new("Camera")
currentCamera.FieldOfView = 1
currentCamera.CameraType = Enum.CameraType.Scriptable
currentCamera.Parent = workspace
minimapFrame.CurrentCamera = currentCamera
local playerobjflag = workspace.red:Clone()
playerobjflag.Parent = minimapFrame
for i,minimapobj in pairs(workspace.map:GetChildren()) do
minimapobj:Clone().Parent = minimapFrame
end
local flags={}
game:GetService("RunService").RenderStepped:Connect(function()
local camCFrame = CFrame.new(hrp.Position + Vector3.new(0,9000,0),hrp.Position)
currentCamera.CFrame = camCFrame
localplayer.Rotation = -hrp.Orientation.Y - 90
for _,v in pairs(game.Players:GetChildren()) do
if v.UserId ~= plr.UserId then
local char = v.Character or v.CharacterAdded:Wait()
local hrp1 = char:WaitForChild("HumanoidRootPart")
if not flags[v.UserId] then
flags[v.UserId] = VehicleLocation:Clone()
flags[v.UserId].Parent = minimapFrame
flags[v.UserId].Visible = true
end
local angle = math.atan2(hrp1.CFrame.lookVector.x, hrp1.CFrame.lookVector.z)
local degrees = math.ceil(math.abs(math.deg(angle)-180))
--VehicleLocation.Position = UDim2.new(0,hrp.Position.X/512,0,hrp.Position.Y/512)
--playerobjflag.Position = Vector3.new(hrp.Position.X,0,0)
local basePos = workspace.Baseplate.Position
local baseSize = workspace.Baseplate.Size
local playerPos = hrp1.Position
local position = ((playerPos - hrp.Position)/1)*2
local v2_position = Vector2.new(position.x, position.z)
--local radar = script.Parent
--local Ppos = radar.Frame
flags[v.UserId].Rotation = degrees
flags[v.UserId].Position = UDim2.new(0.5, (v2position.x), 0.5, (v2position.y))
end
end
end)
版权声明: 本文为 InfoQ 作者【katichar】的原创文章。
原文链接:【http://xie.infoq.cn/article/ea048e90c823af75373eaadf8】。文章转载请联系作者。
评论