I want to get the players NAT type to create a NAT type text label in my game UI menus, I put this in a local script inside of a textlabel, it doesnt work.
local TextLabel = script.Parent
-- Function to get the player's NAT type
local function getNATType()
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local NATType = player.NetworkSettings.NetworkTopology
return NATType
end
-- Function to update the text label
local function updateTextLabel()
local natType = getNATType()
TextLabel.Text = "Nat Type: " .. natType
end
-- Update the text label initially
updateTextLabel()
-- Update the text label whenever the NAT type changes
game:GetService("Players").LocalPlayer.NetworkSettings.NetworkTopologyChanged:Connect(updateTextLabel)