-- Basic settings

local MAX_LENGTH = 30

local filterService = game:GetService("TextService")

game.ReplicatedStorage.Interactions.Server.SetPetName.OnServerInvoke = function(plr, newName)
	
	-- Check length
	if string.len(newName) <= MAX_LENGTH then
	
		-- Run through filter service and set
		plr.Settings.PetName.Value = newName
		
		-- Set pet name
		for _, i in pairs(game.Players:GetPlayers()) do
			spawn(function()
				game.ReplicatedStorage.Interactions.Client.SetPetName:FireAllClients(plr, filterService:FilterStringAsync(newName, plr.UserId):GetNonChatStringForUserAsync(i.UserId))
			end)
		end
		
		return "NAME SET"
	else
		return "TOO LONG"
	end
	
end
