#minimap script not working

1 messages · Page 1 of 1 (latest)

dusty panther
#

local function UpdatePlayers()
local FocusX = Camera.Focus.Position.X / ChunkSize
local FocusZ = Camera.Focus.Position.Z / ChunkSize

for player, gui in ipairs(Players) do
    if player.Character == nil then continue end
    local CFrame = player.Character:GetPivot()
    local x = CFrame.Position.X / ChunkSize
    local z = CFrame.Position.Z / ChunkSize
    gui.Position = UDim2.new(0.5 - FocusX + x, 0, 0.5 - FocusZ + z, 0)
end

end

local function PlayerAdded(player)
local GUI = PlayerGUI:Clone()
GUI.TextLabel.Text = player.Name
GUI.Parent = Frame
Players[player] = GUI
end

local function PlayerRemoving(player)
Players[player]:Destroy()
Players[player].Parent = nil
end

SetOffset(500)

Camera:GetPropertyChangedSignal("Focus"):Connect(Update)

runService.RenderStepped:Connect(UpdatePlayers)

Frame.UpButton.Activated:Connect(function()
print("clicked")
SetOffset(Offset.Y + 50)
end)

Frame.DownButton.Activated:Connect(function()
print("clicked")
SetOffset(Offset.Y - 50)
end)

for i, player in ipairs(game.Players:GetPlayers()) do PlayerAdded(player) end

game.Players.PlayerAdded:Connect(PlayerAdded)
game.Players.PlayerRemoving:Connect(PlayerRemoving)

#

for some reason the buttons dont work

woeful prairie
#
copy this text for code block