local gui = script.Parent local camera = workspace.CurrentCamera local viewPortFrame =…
- User
local gui = script.Parent local camera = workspace.CurrentCamera local viewPortFrame = gui.Minimap local playerIcon = viewPortFrame.DirectionArrow local clicked = false
for i, descendat in ipairs(workspace.MinimapObjects.Map:GetDescendants()) do if descendat:IsA("BasePart") then local clone = descendat:Clone() clone.Transparency = 0 clone.Parent = viewPortFrame end end
local viewPortCamera = Instance.new("Camera") viewPortCamera.FieldOfView = 70 viewPortFrame.CurrentCamera = viewPortCamera
local offset = Vector3.new(0, 525, 0)
camera:GetPropertyChangedSignal("Focus"):Connect(function() local position = Vector3.new(0, 0, 0) viewPortCamera.CFrame = CFrame.lookAt(position + offset, position -Vector3.zAxis) end)
local MapGUIsize = 0.25 local player = game.Players.LocalPlayer local MapSize = 1000 coroutine.wrap(function() while wait(0) do local character = player.Character local HumanoidRootPart = character:FindFirstChild("HumanoidRootPart") if HumanoidRootPart then local X =(HumanoidRootPart.Position.X+(MapSize/2))/MapSize local Y = (HumanoidRootPart.Position.Z+(MapSize/2))/MapSize local position = HumanoidRootPart.Position playerIcon.Rotation = -HumanoidRootPart.Orientation.Y playerIcon.Position = UDim2.new(X,0,Y,0) end end end)()
local mouse = player:GetMouse()
mouse.Button1Down:Connect(function() clicked = true end)
mouse.Button1Up:Connect(function() clicked = false end)
viewPortFrame.MouseMoved:Connect(function(x, y) if clicked == true then local cameraPart = game.Workspace.CameraPart cameraPart.CFrame = CFrame.new(((x)/MapSize) * MapSize - (MapSize/2), cameraPart.Position.Y, ((y)/MapSize) * MapSize - (MapSize/2)) end end) СДЕЛАЙ ТАК ЧТОБЫ PART CAMERAPART ПЕРЕДВИГАЛСЯ ТУДА КУДА Я КЛИКНУ НА МИНИКАРТЕ. СЕЙЧАС ОНО РАБОТАЕТ, НО КОГДА КЛИКАЮ ПОКАЗЫВАЕТ ЛИШЬ ОДНУ ПЯТУЮ ОТ ПОЛНОЙ КАРТЫ
- Assistant
To make the "CameraPart" move to the clicked position on the minimap, you can add the following code inside the "viewPortFrame.MouseMoved" event:
viewPortFrame.MouseMoved:Connect(function(x, y) if clicked == true then local cameraPart = game.Workspace.CameraPart -- Calculate the target position based on the mouse coordinates local targetPosition = Vector3.new( ((x-15) / 328) * MapSize - (MapSize / 2), cameraPart.Position.Y, ((y-15) / 328) * MapSize - (MapSize / 2) ) -- Move the cameraPart towards the target position cameraPart.Position = cameraPart.Position + (targetPosition - cameraPart.Position) * 0.1 end end)Make sure to replace "game.Workspace.CameraPart" with the actual path to your "CameraPart" object.
This code calculates the target position on the minimap based on the mouse coordinates, then smoothly moves the "CameraPart" towards that position using a lerping effect. Adjust the multiplication factor (0.1) in the last line to control the speed of the movement.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.